Control on udp_address conversion

In its_bridge_client.c:176 there is no check about return value of inet_pton function (return 1 on success). So, if in the config the udp_address is not written correct, the bridge tries to send udp messages to address 0.0.0.0.

Solution: added check to return value of inet_pton function.

Merge request reports

Loading
+5 −1
Changes for src/its_bridge_client.c: 5 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -173,7 +173,11 @@ int main(const int32_t p_argc, char* const p_argv[]) {
    }
    memset((void*)&remote_addr, 0x00, sizeof(struct sockaddr_in));
    remote_addr.sin_family = AF_INET;
    inet_pton(AF_INET, udp_address, &remote_addr.sin_addr);
    if (inet_pton(AF_INET, udp_address, &remote_addr.sin_addr) != 1) {
		fprintf(stderr, "Failed to convert UDP_ADDRESS");
		close(socket_hd);
		goto error;
	}
    remote_addr.sin_port = htons(udp_port);

    if (test_generate) {
Loading