libusbmuxd-2.1.0-1.fc42

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-688): [#def1]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c: scope_hint: In function 'connect_usbmuxd_socket'
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c:195:45: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'connect_addr' where non-null expected
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c:30: included_from: Included from here.
/usr/include/string.h:273:14: note: argument 1 of 'strrchr' must be non-null
#  193|   					connect_addr = strdup(usbmuxd_socket_addr+1);
#  194|   					connect_addr[p - usbmuxd_socket_addr - 1] = '\0';
#  195|-> 					p = strrchr(connect_addr, ']');
#  196|   					if (p) {
#  197|   						*p = '\0';

Error: GCC_ANALYZER_WARNING (CWE-476): [#def2]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c:203:53: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'connect_addr'
#  201|   					connect_addr[p - usbmuxd_socket_addr] = '\0';
#  202|   				}
#  203|-> 				if (connect_addr && *connect_addr != '\0') {
#  204|   					res = socket_connect(connect_addr, port);
#  205|   #ifdef HAVE_INOTIFY

Error: GCC_ANALYZER_WARNING (CWE-476): [#def3]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c: scope_hint: In function 'receive_packet'
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c:409:33: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'res'
#  407|   				*payload = malloc(sizeof(uint32_t));
#  408|   				dwval = val;
#  409|-> 				memcpy(*payload, &dwval, sizeof(dwval));
#  410|   				hdr.length = sizeof(hdr) + sizeof(dwval);
#  411|   				hdr.message = MESSAGE_RESULT;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def4]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c:441:41: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'res'
#  439|   					*payload = malloc(sizeof(uint32_t));
#  440|   					dwval = val;
#  441|-> 					memcpy(*payload, &dwval, sizeof(dwval));
#  442|   					hdr.length = sizeof(hdr) + sizeof(dwval);
#  443|   					hdr.message = MESSAGE_DEVICE_REMOVE;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def5]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c:453:41: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'res'
#  451|   					*payload = malloc(sizeof(uint32_t));
#  452|   					dwval = val;
#  453|-> 					memcpy(*payload, &dwval, sizeof(dwval));
#  454|   					hdr.length = sizeof(hdr) + sizeof(dwval);
#  455|   					hdr.message = MESSAGE_DEVICE_PAIRED;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def6]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c: scope_hint: In function 'get_prog_name'
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c:704:53: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'p'
#  702|   	if (r > 0) {
#  703|   		char *p = tmpbuf;
#  704|-> 		while (((size_t)(p-tmpbuf) < r) && (*p != '(') && (*p != '\0')) p++;
#  705|   		if (*p == '(') {
#  706|   			p++;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def7]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/src/libusbmuxd.c:705:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'p'
#  703|   		char *p = tmpbuf;
#  704|   		while (((size_t)(p-tmpbuf) < r) && (*p != '(') && (*p != '\0')) p++;
#  705|-> 		if (*p == '(') {
#  706|   			p++;
#  707|   			char *pname = p;

Error: COMPILER_WARNING (CWE-252): [#def8]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/tools/inetcat.c: scope_hint: In function ‘main’
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/tools/inetcat.c:274:13: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  274 |             write(devfd, buf, n);
#      |             ^~~~~~~~~~~~~~~~~~~~
#  272|                   break;
#  273|               }
#  274|->             write(devfd, buf, n);
#  275|           }
#  276|   

Error: COMPILER_WARNING (CWE-252): [#def9]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/tools/inetcat.c:282:13: warning[-Wunused-result]: ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’
#  282 |             write(STDOUT_FILENO, buf, n);
#      |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
#  280|                   break;
#  281|               }
#  282|->             write(STDOUT_FILENO, buf, n);
#  283|           }
#  284|       }

Error: GCC_ANALYZER_WARNING (CWE-457): [#def10]
/usr/include/sys/types.h:179: included_from: Included from here.
/usr/include/stdlib.h:514: included_from: Included from here.
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/tools/iproxy.c:33: included_from: Included from here.
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/tools/iproxy.c: scope_hint: In function ‘main’
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/tools/iproxy.c:434:52: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘listen_sock[i].fd’
/usr/include/sys/select.h:30: included_from: Included from here.
#  432|   		}
#  433|   		for (i = 0; i < num_listen; i++) {
#  434|-> 			if (FD_ISSET(listen_sock[i].fd, &read_fds)) {
#  435|   				THREAD_T acceptor = THREAD_T_NULL;
#  436|   				struct client_data *cdata;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def11]
libusbmuxd-2.1.0-build/libusbmuxd-2.1.0/tools/iproxy.c:466:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘listen_sock[i].fd’
#  464|   
#  465|   	for (i = 0; i < num_listen; i++) {
#  466|-> 		socket_close(listen_sock[i].fd);
#  467|   	}
#  468|   

Scan Properties

analyzer-version-clippy1.82.0
analyzer-version-cppcheck2.16.0
analyzer-version-gcc14.2.1
analyzer-version-gcc-analyzer15.0.0
analyzer-version-shellcheck0.10.0
analyzer-version-unicontrol0.0.2
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-98.us-west-2.compute.internal
mock-configfedora-rawhide-gcc-latest-x86_64
project-namelibusbmuxd-2.1.0-1.fc42
store-results-to/tmp/tmpkl3c_52n/libusbmuxd-2.1.0-1.fc42.tar.xz
time-created2024-11-13 01:47:02
time-finished2024-11-13 01:48:19
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-gcc-latest-x86_64' '-t' 'clippy,cppcheck,gcc,unicontrol,shellcheck' '-o' '/tmp/tmpkl3c_52n/libusbmuxd-2.1.0-1.fc42.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install=gcc-latest' '--gcc-analyzer-bin=/opt/gcc-latest/bin/gcc' '/tmp/tmpkl3c_52n/libusbmuxd-2.1.0-1.fc42.src.rpm'
tool-versioncsmock-3.7.1.20241107.094801.gb3f0f26.pr_192-1.el9