Fixed findings

List of Findings

Error: GCC_ANALYZER_WARNING (CWE-775): [#def1]
bluez-5.86/btio/btio.c:255:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘g_io_channel_unix_get_fd(io)’
#  253|   	srv_sock = g_io_channel_unix_get_fd(io);
#  254|   
#  255|-> 	cli_sock = accept(srv_sock, NULL, NULL);
#  256|   	if (cli_sock < 0) {
#  257|   		if (errno == EBADFD)

Error: COMPILER_WARNING: [#def2]
bluez-5.86/mesh/net.c: scope_hint: In function ‘ack_received’
bluez-5.86/mesh/net.c:1569:18: warning[-Wunused-but-set-variable=]: variable ‘ack_copy’ set but not used
# 1569 |         uint32_t ack_copy = ack_flag;
#      |                  ^~~~~~~~
# 1567|   	struct mesh_sar *outgoing;
# 1568|   	uint32_t seg_flag = 0x00000001;
# 1569|-> 	uint32_t ack_copy = ack_flag;
# 1570|   	uint16_t i;
# 1571|   

Error: COMPILER_WARNING (CWE-704): [#def3]
bluez-5.86/mesh/util.c: scope_hint: In function ‘create_dir’
bluez-5.86/mesh/util.c:108:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  108 |         prev = strchr(dir_name, '/');
#      |              ^
#  106|   	strcat(dir, "/");
#  107|   
#  108|-> 	prev = strchr(dir_name, '/');
#  109|   
#  110|   	while (prev) {

Error: COMPILER_WARNING (CWE-704): [#def4]
bluez-5.86/mesh/util.c:108:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  106|   	strcat(dir, "/");
#  107|   
#  108|-> 	prev = strchr(dir_name, '/');
#  109|   
#  110|   	while (prev) {

Error: COMPILER_WARNING: [#def5]
bluez-5.86/monitor/avctp.c: scope_hint: In function ‘avrcp_get_capabilities’
bluez-5.86/monitor/avctp.c:806:13: warning[-Wunused-but-set-variable=]: variable ‘i’ set but not used
#  806 |         int i;
#      |             ^
#  804|   	struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
#  805|   	uint8_t cap, count;
#  806|-> 	int i;
#  807|   
#  808|   	if (!l2cap_frame_get_u8(frame, &cap))

Error: COMPILER_WARNING: [#def6]
bluez-5.86/monitor/avctp.c: scope_hint: In function ‘avrcp_list_player_attributes’
bluez-5.86/monitor/avctp.c:861:13: warning[-Wunused-but-set-variable=]: variable ‘i’ set but not used
#  861 |         int i;
#      |             ^
#  859|   	struct l2cap_frame *frame = &avctp_frame->l2cap_frame;
#  860|   	uint8_t num;
#  861|-> 	int i;
#  862|   
#  863|   	if (len == 0)

Error: COMPILER_WARNING: [#def7]
bluez-5.86/src/sdpd-request.c: scope_hint: In function ‘extract_des’
bluez-5.86/src/sdpd-request.c:141:15: warning[-Wunused-but-set-variable=]: variable ‘numberOfElements’ set but not used
#  141 |         short numberOfElements = 0;
#      |               ^~~~~~~~~~~~~~~~
#  139|   	uint8_t seqType;
#  140|   	int scanned, data_size = 0;
#  141|-> 	short numberOfElements = 0;
#  142|   	int seqlen = 0;
#  143|   	sdp_list_t *pSeq = NULL;

Error: COMPILER_WARNING: [#def8]
bluez-5.86/src/shared/shell.c: scope_hint: In function 'menu_generator'
bluez-5.86/src/shared/shell.c:182:29: warning[-Wunused-but-set-variable=]: variable 'index' set but not used
#  182 |         static unsigned int index, len;
#      |                             ^~~~~
#  180|   static char *menu_generator(const char *text, int state)
#  181|   {
#  182|-> 	static unsigned int index, len;
#  183|   	static struct queue_entry *entry;
#  184|   

Error: COMPILER_WARNING (CWE-704): [#def9]
bluez-5.86/src/shared/shell.c: scope_hint: In function 'cmd_exec'
bluez-5.86/src/shared/shell.c:550:13: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  550 |         man = strrchr(entry->arg, '>');
#      |             ^
#  548|   
#  549|   	/* Find last mandatory arguments */
#  550|-> 	man = strrchr(entry->arg, '>');
#  551|   	if (!man) {
#  552|   		opt = strdup(entry->arg);

Error: COMPILER_WARNING (CWE-704): [#def10]
bluez-5.86/src/shared/shell.c:550:13: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  548|   
#  549|   	/* Find last mandatory arguments */
#  550|-> 	man = strrchr(entry->arg, '>');
#  551|   	if (!man) {
#  552|   		opt = strdup(entry->arg);

Error: COMPILER_WARNING (CWE-704): [#def11]
bluez-5.86/src/shared/shell.c:561:21: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  561 |                 opt = strrchr(entry->arg, '<');
#      |                     ^
#  559|   	else {
#  560|   		/* Find where mandatory arguments start */
#  561|-> 		opt = strrchr(entry->arg, '<');
#  562|   		/* Skip if mandatory arguments are not in the right format */
#  563|   		if (!opt || opt > man) {

Error: COMPILER_WARNING (CWE-704): [#def12]
bluez-5.86/src/shared/shell.c:561:21: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
#  559|   	else {
#  560|   		/* Find where mandatory arguments start */
#  561|-> 		opt = strrchr(entry->arg, '<');
#  562|   		/* Skip if mandatory arguments are not in the right format */
#  563|   		if (!opt || opt > man) {

Error: COMPILER_WARNING (CWE-704): [#def13]
bluez-5.86/src/shared/shell.c: scope_hint: In function 'cmd_generator'
bluez-5.86/src/shared/shell.c:1012:21: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 1012 |                 cmd = strrchr(text, '.');
#      |                     ^
# 1010|   			return cmd;
# 1011|   
# 1012|-> 		cmd = strrchr(text, '.');
# 1013|   		if (!cmd)
# 1014|   			return NULL;

Error: COMPILER_WARNING (CWE-704): [#def14]
bluez-5.86/src/shared/shell.c:1012:21: warning[-Wdiscarded-qualifiers]: assignment discards 'const' qualifier from pointer target type
# 1010|   			return cmd;
# 1011|   
# 1012|-> 		cmd = strrchr(text, '.');
# 1013|   		if (!cmd)
# 1014|   			return NULL;

Error: COMPILER_WARNING (CWE-704): [#def15]
bluez-5.86/src/textfile.c: scope_hint: In function ‘create_dirs’
bluez-5.86/src/textfile.c:81:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#   81 |         prev = strchr(filename, '/');
#      |              ^
#   79|   	strcat(dir, "/");
#   80|   
#   81|-> 	prev = strchr(filename, '/');
#   82|   
#   83|   	while (prev) {

Error: COMPILER_WARNING (CWE-704): [#def16]
bluez-5.86/src/textfile.c:81:14: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#   79|   	strcat(dir, "/");
#   80|   
#   81|-> 	prev = strchr(filename, '/');
#   82|   
#   83|   	while (prev) {

Error: COMPILER_WARNING: [#def17]
bluez-5.86/tools/btsnoop.c: scope_hint: In function ‘command_extract_eir’
bluez-5.86/tools/btsnoop.c:269:17: warning[-Wunused-but-set-variable=]: variable ‘count’ set but not used
#  269 |         int fd, count = 0;
#      |                 ^~~~~
#  267|   	uint32_t type, toread, flags;
#  268|   	uint16_t opcode;
#  269|-> 	int fd, count = 0;
#  270|   
#  271|   	fd = open_btsnoop(input, &type);

Error: COMPILER_WARNING: [#def18]
bluez-5.86/tools/btsnoop.c: scope_hint: In function ‘command_extract_ad’
bluez-5.86/tools/btsnoop.c:342:17: warning[-Wunused-but-set-variable=]: variable ‘count’ set but not used
#  342 |         int fd, count = 0;
#      |                 ^~~~~
#  340|   	uint32_t type, toread, flags;
#  341|   	uint16_t opcode;
#  342|-> 	int fd, count = 0;
#  343|   
#  344|   	fd = open_btsnoop(input, &type);

Error: COMPILER_WARNING (CWE-704): [#def19]
bluez-5.86/tools/hciattach_ath3k.c: scope_hint: In function ‘update_char_count’
bluez-5.86/tools/hciattach_ath3k.c:309:25: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  309 |                 end_ptr = strstr(buf, "]");
#      |                         ^
#  307|   
#  308|   	if (strstr(buf, "[") == buf) {
#  309|-> 		end_ptr = strstr(buf, "]");
#  310|   		if (!end_ptr)
#  311|   			return 0;

Error: COMPILER_WARNING (CWE-704): [#def20]
bluez-5.86/tools/hciattach_ath3k.c:309:25: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
#  307|   
#  308|   	if (strstr(buf, "[") == buf) {
#  309|-> 		end_ptr = strstr(buf, "]");
#  310|   		if (!end_ptr)
#  311|   			return 0;

Error: GCC_ANALYZER_WARNING (CWE-457): [#def21]
bluez-5.86/tools/hcidump.c:240:39: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘frm.ts.tv_sec’
bluez-5.86/tools/hcidump.c:140:12: branch_false: following ‘false’ branch (when ‘sock >= 0’)...
bluez-5.86/tools/hcidump.c:143:13: branch_false: ...to here
bluez-5.86/tools/hcidump.c:150:12: branch_false: following ‘false’ branch (when ‘buf’ is non-NULL)...
bluez-5.86/tools/hcidump.c:157:20: branch_false: ...to here
bluez-5.86/tools/hcidump.c:178:29: branch_true: following ‘true’ branch (when ‘i == 0’)...
bluez-5.86/tools/hcidump.c:179:29: branch_true: ...to here
bluez-5.86/tools/hcidump.c:179:28: branch_false: following ‘false’ branch...
bluez-5.86/tools/hcidump.c:179:28: branch_false: ...to here
bluez-5.86/tools/hcidump.c:212:24: branch_false: following ‘false’ branch (when ‘cmsg’ is NULL)...
bluez-5.86/tools/hcidump.c:227:27: branch_false: ...to here
bluez-5.86/tools/hcidump.c:230:17: branch_true: following ‘true’ branch...
bluez-5.86/tools/hcidump.c:231:17: branch_true: ...to here
bluez-5.86/tools/hcidump.c:233:28: branch_true: following ‘true’ branch...
bluez-5.86/tools/hcidump.c:235:41: branch_true: ...to here
bluez-5.86/tools/hcidump.c:240:39: danger: use of uninitialized value ‘frm.ts.tv_sec’ here
#  238|   				dp->flags = be32toh(frm.in & 0x01);
#  239|   				dp->drops = 0;
#  240|-> 				ts = (frm.ts.tv_sec - 946684800ll) * 1000000ll + frm.ts.tv_usec;
#  241|   				dp->ts = htobe64(ts + 0x00E03AB44A676000ll);
#  242|   				if (pkt_type == HCI_COMMAND_PKT ||

Error: GCC_ANALYZER_WARNING (CWE-457): [#def22]
bluez-5.86/tools/hcidump.c:248:47: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘frm.ts.tv_sec’
bluez-5.86/tools/hcidump.c:140:12: branch_false: following ‘false’ branch (when ‘sock >= 0’)...
bluez-5.86/tools/hcidump.c:143:13: branch_false: ...to here
bluez-5.86/tools/hcidump.c:150:12: branch_false: following ‘false’ branch (when ‘buf’ is non-NULL)...
bluez-5.86/tools/hcidump.c:157:20: branch_false: ...to here
bluez-5.86/tools/hcidump.c:178:29: branch_true: following ‘true’ branch (when ‘i == 0’)...
bluez-5.86/tools/hcidump.c:179:29: branch_true: ...to here
bluez-5.86/tools/hcidump.c:179:28: branch_false: following ‘false’ branch...
bluez-5.86/tools/hcidump.c:179:28: branch_false: ...to here
bluez-5.86/tools/hcidump.c:212:24: branch_false: following ‘false’ branch (when ‘cmsg’ is NULL)...
bluez-5.86/tools/hcidump.c:227:27: branch_false: ...to here
bluez-5.86/tools/hcidump.c:230:17: branch_true: following ‘true’ branch...
bluez-5.86/tools/hcidump.c:231:17: branch_true: ...to here
bluez-5.86/tools/hcidump.c:233:28: branch_false: following ‘false’ branch...
bluez-5.86/tools/hcidump.c:246:33: branch_false: ...to here
bluez-5.86/tools/hcidump.c:248:47: danger: use of uninitialized value ‘frm.ts.tv_sec’ here
#  246|   				dh->len = htobs(frm.data_len);
#  247|   				dh->in  = frm.in;
#  248|-> 				dh->ts_sec  = htobl(frm.ts.tv_sec);
#  249|   				dh->ts_usec = htobl(frm.ts.tv_usec);
#  250|   			}

Error: GCC_ANALYZER_WARNING (CWE-401): [#def23]
bluez-5.86/tools/hcidump.c:266:1: warning[-Wanalyzer-malloc-leak]: leak of ‘buf’
bluez-5.86/tools/hcidump.c:140:12: branch_false: following ‘false’ branch (when ‘sock >= 0’)...
bluez-5.86/tools/hcidump.c:143:13: branch_false: ...to here
bluez-5.86/tools/hcidump.c:149:15: acquire_memory: allocated here
bluez-5.86/tools/hcidump.c:150:12: branch_false: following ‘false’ branch (when ‘buf’ is non-NULL)...
bluez-5.86/tools/hcidump.c:157:20: branch_false: ...to here
bluez-5.86/tools/hcidump.c:178:29: branch_true: following ‘true’ branch (when ‘i == 0’)...
bluez-5.86/tools/hcidump.c:179:29: branch_true: ...to here
bluez-5.86/tools/hcidump.c:266:1: danger: ‘buf’ leaks here; was allocated at [(3)](sarif:/runs/0/results/2/codeFlows/0/threadFlows/0/locations/2)
#  264|   
#  265|   	return 0;
#  266|-> }
#  267|   
#  268|   static void read_dump(int fd)

Error: COMPILER_WARNING (CWE-704): [#def24]
bluez-5.86/tools/mesh/mesh-db.c: scope_hint: In function ‘mesh_db_finish_export’
bluez-5.86/tools/mesh/mesh-db.c:2598:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2598 |         pos = strrchr(hdr, '}');
#      |             ^
# 2596|   	 */
# 2597|   
# 2598|-> 	pos = strrchr(hdr, '}');
# 2599|   	if (!pos)
# 2600|   		goto done;

Error: COMPILER_WARNING (CWE-704): [#def25]
bluez-5.86/tools/mesh/mesh-db.c:2598:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2596|   	 */
# 2597|   
# 2598|-> 	pos = strrchr(hdr, '}');
# 2599|   	if (!pos)
# 2600|   		goto done;

Error: COMPILER_WARNING (CWE-704): [#def26]
bluez-5.86/tools/mesh/mesh-db.c:2604:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2604 |         pos = strrchr(hdr, '"');
#      |             ^
# 2602|   	*pos = '\0';
# 2603|   
# 2604|-> 	pos = strrchr(hdr, '"');
# 2605|   	if (!pos)
# 2606|   		goto done;

Error: COMPILER_WARNING (CWE-704): [#def27]
bluez-5.86/tools/mesh/mesh-db.c:2604:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2602|   	*pos = '\0';
# 2603|   
# 2604|-> 	pos = strrchr(hdr, '"');
# 2605|   	if (!pos)
# 2606|   		goto done;

Error: COMPILER_WARNING (CWE-704): [#def28]
bluez-5.86/tools/mesh/mesh-db.c:2613:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2613 |         pos = strchr(str, '{');
#      |             ^
# 2611|   		goto done;
# 2612|   
# 2613|-> 	pos = strchr(str, '{');
# 2614|   	if (!pos || pos[1] == '\0')
# 2615|   		goto done;

Error: COMPILER_WARNING (CWE-704): [#def29]
bluez-5.86/tools/mesh/mesh-db.c:2613:13: warning[-Wdiscarded-qualifiers]: assignment discards ‘const’ qualifier from pointer target type
# 2611|   		goto done;
# 2612|   
# 2613|-> 	pos = strchr(str, '{');
# 2614|   	if (!pos || pos[1] == '\0')
# 2615|   		goto done;

Error: GCC_ANALYZER_WARNING (CWE-476): [#def30]
bluez-5.86/tools/parser/parser.h:132:32: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘f’
bluez-5.86/tools/parser/l2cap.c:1199:6: enter_function: entry to ‘l2cap_dump’
bluez-5.86/tools/parser/l2cap.c:1209:20: branch_false: following ‘false’ branch...
bluez-5.86/tools/parser/l2cap.c:1215:20: branch_false: ...to here
bluez-5.86/tools/parser/l2cap.c:1215:20: branch_true: following ‘true’ branch...
bluez-5.86/tools/parser/l2cap.c:1217:25: branch_true: ...to here
bluez-5.86/tools/parser/l2cap.c:1217:25: call_function: calling ‘l2cap_parse’ from ‘l2cap_dump’
#  130|   						(long long)f->ts.tv_usec);
#  131|   		}
#  132|-> 		printf("%c ", (f->in ? '>' : '<'));
#  133|   		parser.state = 1;
#  134|   	} else 

Error: COMPILER_WARNING: [#def31]
bluez-5.86/tools/seq2bseq.c: scope_hint: In function ‘convert_file’
bluez-5.86/tools/seq2bseq.c:62:15: warning[-Wunused-but-set-variable=]: variable ‘cur’ set but not used
#   62 |         off_t cur = 0;
#      |               ^~~
#   60|   	FILE *fp;
#   61|   	struct stat st;
#   62|-> 	off_t cur = 0;
#   63|   	int fd;
#   64|   

Scan Properties

analyzer-version-clippy1.97.1
analyzer-version-cppcheck2.21.1
analyzer-version-gcc16.1.1
analyzer-version-gcc-analyzer16.1.1
analyzer-version-shellcheck0.11.0
analyzer-version-unicontrol0.0.2
diffbase-analyzer-version-clippy1.97.1
diffbase-analyzer-version-cppcheck2.21.1
diffbase-analyzer-version-gcc16.1.1
diffbase-analyzer-version-gcc-analyzer16.1.1
diffbase-analyzer-version-shellcheck0.11.0
diffbase-analyzer-version-unicontrol0.0.2
diffbase-enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
diffbase-exit-code0
diffbase-hostip-172-16-1-225.us-west-2.compute.internal
diffbase-known-false-positives/usr/share/csmock/known-false-positives.js
diffbase-known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
diffbase-mock-configfedora-rawhide-x86_64
diffbase-project-namebluez-5.87-4.fc45
diffbase-store-results-to/tmp/tmpzh_r9xlh/bluez-5.87-4.fc45.tar.xz
diffbase-time-created2026-08-03 13:33:23
diffbase-time-finished2026-08-03 13:36:59
diffbase-toolcsmock
diffbase-tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmpzh_r9xlh/bluez-5.87-4.fc45.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmpzh_r9xlh/bluez-5.87-4.fc45.src.rpm'
diffbase-tool-versioncsmock-3.8.7.HEAD-1.el9
enabled-pluginsclippy, cppcheck, gcc, shellcheck, unicontrol
exit-code0
hostip-172-16-1-225.us-west-2.compute.internal
known-false-positives/usr/share/csmock/known-false-positives.js
known-false-positives-rpmknown-false-positives-0.0.0.20260524.213755.g3c6d0be.main-1.el9.noarch
mock-configfedora-rawhide-x86_64
project-namebluez-5.86-4.fc44
store-results-to/tmp/tmphchyonoj/bluez-5.86-4.fc44.tar.xz
time-created2026-08-03 13:28:36
time-finished2026-08-03 13:33:04
titleFixed findings
toolcsmock
tool-args'/usr/bin/csmock' '-r' 'fedora-rawhide-x86_64' '-t' 'gcc,clippy,unicontrol,shellcheck,cppcheck' '-o' '/tmp/tmphchyonoj/bluez-5.86-4.fc44.tar.xz' '--gcc-analyze' '--unicontrol-notests' '--unicontrol-bidi-only' '--install' 'pam' '--gcc-analyzer-bin=/usr/bin/gcc' '/tmp/tmphchyonoj/bluez-5.86-4.fc44.src.rpm'
tool-versioncsmock-3.8.7.HEAD-1.el9