Task #41 - bluez-5.73-3.fc40/scan-results.err
back to task #41download
Error: CLANG_WARNING: bluez-5.73/attrib/gatt.c:970:2: warning[unix.Malloc]: Potential leak of memory pointed to by 'long_write' # 968| long_write->vlen = vlen; # 969| # 970|-> return prepare_write(long_write); # 971| } # 972| Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/attrib/gattrib.c: scope_hint: In function ‘construct_full_pdu’ bluez-5.73/attrib/gattrib.c:207:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘pdu’ # 205| # 206| if (pdu && length) # 207|-> memcpy(buf + 1, pdu, length); # 208| # 209| return buf; Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/btio/btio.c: scope_hint: In function ‘server_cb.part.0’ bluez-5.73/btio/btio.c:256:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘g_io_channel_unix_get_fd(io)’ # 254| # 255| cli_sock = accept(srv_sock, NULL, NULL); # 256|-> if (cli_sock < 0) # 257| return TRUE; # 258| Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/btio/btio.c: scope_hint: In function ‘sco_connect’ bluez-5.73/btio/btio.c:2055:21: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘g_io_channel_unix_get_fd(create_io(0, &opts, gerr))’ bluez-5.73/btio/btio.c:21: included_from: Included from here. # 2053| } # 2054| # 2055|-> switch (opts.type) { # 2056| case BT_IO_L2CAP: # 2057| err = l2cap_connect(sock, &opts.dst, opts.dst_type, Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/btio/btio.c: scope_hint: In function ‘bt_io_listen’ bluez-5.73/btio/btio.c:2120:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘g_io_channel_unix_get_fd(create_io(1, &opts, err))’ # 2118| } # 2119| # 2120|-> if (listen(sock, 5) < 0) { # 2121| ERROR_FAILED(err, "listen", errno); # 2122| g_io_channel_unref(io); Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/client/advertising.c: scope_hint: In function ‘ad_register’ bluez-5.73/client/advertising.c:524:14: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. bluez-5.73/gdbus/gdbus.h:19: included_from: Included from here. bluez-5.73/client/advertising.c:22: included_from: Included from here. bluez-5.73/client/advertising.c:522:19: note: in expansion of macro ‘g_strdup’ bluez-5.73/client/advertising.c: scope_hint: In function ‘ad_register’ /usr/include/string.h:462: included_from: Included from here. bluez-5.73/client/advertising.c:20: included_from: Included from here. /usr/include/strings.h:116:12: note: argument 1 of ‘strcasecmp’ must be non-null # 522| ad.type = g_strdup(type); # 523| # 524|-> if (!strcasecmp(ad.type, "Broadcast")) # 525| ad.discoverable = false; # 526| Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/client/display.c: scope_hint: In function ‘rl_printf’ bluez-5.73/client/display.c:53:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘saved_line’ # 51| if (save_input) { # 52| rl_restore_prompt(); # 53|-> rl_replace_line(saved_line, 0); # 54| rl_point = saved_point; # 55| rl_forced_update_display(); Error: GCC_ANALYZER_WARNING (CWE-401): bluez-5.73/client/mgmt.c: scope_hint: In function ‘parse_bytes’ bluez-5.73/client/mgmt.c:4640:16: warning[-Wanalyzer-malloc-leak]: leak of ‘adv_data’ # 4638| } # 4639| # 4640|-> *bytes = malloc(*len); # 4641| if (!*bytes) { # 4642| error("Failed to allocate memory"); Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/client/mgmt.c: scope_hint: In function ‘cmd_add_adv’ bluez-5.73/client/mgmt.c:4819:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘adv_data’ # 4817| # 4818| if (adv_len) # 4819|-> memcpy(cp->data + uuid_bytes, adv_data, adv_len); # 4820| # 4821| if (scan_rsp_len) Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/client/mgmt.c: scope_hint: In function ‘cmd_add_ext_adv_data’ bluez-5.73/client/mgmt.c:5243:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘adv_data’ # 5241| # 5242| if (adv_len) # 5243|-> memcpy(cp->data + uuid_bytes, adv_data, adv_len); # 5244| # 5245| if (scan_rsp_len) Error: GCC_ANALYZER_WARNING: bluez-5.73/client/player.c: scope_hint: In function ‘transport_send_seq.part.0’ bluez-5.73/client/player.c:5118:23: warning[-Wanalyzer-fd-use-without-check]: ‘read’ on possibly invalid file descriptor ‘fd’ bluez-5.73/client/player.c: scope_hint: In function ‘transport_send_seq.part.0’ bluez-5.73/client/player.c:20: included_from: Included from here. bluez-5.73/client/player.c: scope_hint: In function ‘transport_send_seq.part.0’ # 5116| off_t offset; # 5117| # 5118|-> ret = read(fd, buf, transport->mtu[1]); # 5119| if (ret <= 0) { # 5120| if (ret < 0) Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/client/player.c: scope_hint: In function ‘cmd_send_transport’ bluez-5.73/client/player.c:5254:32: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd’ bluez-5.73/client/player.c: scope_hint: In function ‘cmd_send_transport’ # 5252| if (!proxy) { # 5253| bt_shell_printf("Transport %s not found\n", argv[i]); # 5254|-> return bt_shell_noninteractive_quit(EXIT_FAILURE); # 5255| } # 5256| Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/emulator/b1ee.c: scope_hint: In function ‘server_read_callback.part.0’ bluez-5.73/emulator/b1ee.c:153:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘server_pkt_data’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 151| ssize_t written; # 152| # 153|-> memcpy(server_pkt_data + server_pkt_len, # 154| ptr, server_pkt_expect); # 155| ptr += server_pkt_expect; Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/emulator/b1ee.c:166:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘server_pkt_data’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 164| server_pkt_data = NULL; # 165| } else { # 166|-> memcpy(server_pkt_data + server_pkt_len, ptr, count); # 167| server_pkt_len += count; # 168| server_pkt_expect -= count; Error: GCC_ANALYZER_WARNING (CWE-401): bluez-5.73/emulator/b1ee.c: scope_hint: In function ‘main’ bluez-5.73/emulator/b1ee.c:267:28: warning[-Wanalyzer-malloc-leak]: leak of ‘server_port’ # 265| case 'p': # 266| server_port = set_port(optarg); # 267|-> if (server_port == NULL) # 268| goto usage; # 269| Error: CLANG_WARNING: bluez-5.73/emulator/b1ee.c:289:2: warning[deadcode.DeadStores]: Value stored to 'argc' is never read # 287| } # 288| # 289|-> argc = argc - optind; # 290| argv = argv + optind; # 291| optind = 0; Error: GCC_ANALYZER_WARNING (CWE-910): bluez-5.73/emulator/b1ee.c:300:19: warning[-Wanalyzer-fd-use-after-close]: ‘write’ on closed file descriptor ‘sniffer_fd’ # 298| sniffer_port ? : DEFAULT_SNIFFER_PORT); # 299| # 300|-> written = write(sniffer_fd, sniff_cmd, sizeof(sniff_cmd)); # 301| if (written < 0) # 302| perror("Failed to enable sniffer"); Error: GCC_ANALYZER_WARNING: bluez-5.73/emulator/b1ee.c:300:19: warning[-Wanalyzer-fd-use-without-check]: ‘write’ on possibly invalid file descriptor ‘-1’ # 298| sniffer_port ? : DEFAULT_SNIFFER_PORT); # 299| # 300|-> written = write(sniffer_fd, sniff_cmd, sizeof(sniff_cmd)); # 301| if (written < 0) # 302| perror("Failed to enable sniffer"); Error: CLANG_WARNING: bluez-5.73/emulator/b1ee.c:322:2: warning[unix.Malloc]: Potential leak of memory pointed to by 'server_port' # 320| # 321| usage: # 322|-> usage(); # 323| done: # 324| free(server_port); Error: CLANG_WARNING: bluez-5.73/emulator/b1ee.c:322:2: warning[unix.Malloc]: Potential leak of memory pointed to by 'sniffer_port' # 320| # 321| usage: # 322|-> usage(); # 323| done: # 324| free(server_port); Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/emulator/btdev.c: scope_hint: In function ‘le_meta_event’ bluez-5.73/emulator/btdev.c:3736:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘data’ bluez-5.73/emulator/btdev.c:31: included_from: Included from here. bluez-5.73/src/shared/util.h:29:27: note: in definition of macro ‘cpu_to_le16’ # 3734| # 3735| if (len > 0) # 3736|-> memcpy(pkt_data + 1, data, len); # 3737| # 3738| send_event(btdev, BT_HCI_EVT_LE_META_EVENT, pkt_data, 1 + len); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/emulator/bthost.c: scope_hint: In function ‘l2cap_conn_req’ bluez-5.73/emulator/bthost.c:1763:38: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘bthost_add_l2cap_conn(bthost, conn, (int)rsp.dcid, (int)rsp.scid, (int)psm)’ bluez-5.73/emulator/bthost.c:38:34: note: in definition of macro ‘acl_handle’ bluez-5.73/emulator/bthost.c: scope_hint: In function ‘l2cap_conn_req’ bluez-5.73/emulator/bthost.c: scope_hint: In function ‘l2cap_conn_req’ # 1761| &conf_req, sizeof(conf_req)); # 1762| # 1763|-> if (cb_data && l2conn->psm == cb_data->psm && cb_data->func) # 1764| cb_data->func(conn->handle, l2conn->dcid, # 1765| cb_data->user_data); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/emulator/bthost.c: scope_hint: In function ‘bthost_set_cig_params’ bluez-5.73/emulator/bthost.c:3184:20: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘cp’ # 3182| cp = malloc(sizeof(*cp) + sizeof(*cp->cis)); # 3183| memset(cp, 0, sizeof(*cp) + sizeof(*cp->cis)); # 3184|-> cp->cig_id = cig_id; # 3185| put_le24(qos->ucast.in.interval ? qos->ucast.in.interval : # 3186| qos->ucast.out.interval, cp->c_interval); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/emulator/bthost.c: scope_hint: In function ‘bthost_create_cis’ bluez-5.73/emulator/bthost.c:3216:21: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘cp’ # 3214| cp = malloc(sizeof(*cp) + sizeof(*cp->cis)); # 3215| memset(cp, 0, sizeof(*cp) + sizeof(*cp->cis)); # 3216|-> cp->num_cis = 0x01; # 3217| cp->cis[0].cis_handle = cpu_to_le16(cis_handle); # 3218| cp->cis[0].acl_handle = cpu_to_le16(acl_handle); Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/emulator/serial.c: scope_hint: In function ‘serial_read_callback.part.0’ bluez-5.73/emulator/serial.c:129:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*(struct serial *)user_data.pkt_data + (sizetype)*(struct serial *)user_data.pkt_len’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 127| # 128| if (count >= serial->pkt_expect) { # 129|-> memcpy(serial->pkt_data + serial->pkt_len, # 130| ptr, serial->pkt_expect); # 131| ptr += serial->pkt_expect; Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/emulator/serial.c:140:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*(struct serial *)user_data.pkt_data + (sizetype)*(struct serial *)user_data.pkt_len’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 138| serial->pkt_data = NULL; # 139| } else { # 140|-> memcpy(serial->pkt_data + serial->pkt_len, ptr, count); # 141| serial->pkt_len += count; # 142| serial->pkt_expect -= count; Error: CPPCHECK_WARNING (CWE-457): bluez-5.73/emulator/serial.c:150: error[legacyUninitvar]: Uninitialized variable: type # 148| static void open_pty(struct serial *serial) # 149| { # 150|-> enum btdev_type uninitialized_var(type); # 151| # 152| serial->fd = posix_openpt(O_RDWR | O_NOCTTY); Error: CLANG_WARNING: bluez-5.73/emulator/serial.c:150:2: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 148| static void open_pty(struct serial *serial) # 149| { # 150|-> enum btdev_type uninitialized_var(type); # 151| # 152| serial->fd = posix_openpt(O_RDWR | O_NOCTTY); Error: CLANG_WARNING: bluez-5.73/emulator/serial.c:150:36: warning[deadcode.DeadStores]: Value stored to 'type' during its initialization is never read # 148| static void open_pty(struct serial *serial) # 149| { # 150|-> enum btdev_type uninitialized_var(type); # 151| # 152| serial->fd = posix_openpt(O_RDWR | O_NOCTTY); Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/emulator/serial.c: scope_hint: In function ‘open_pty’ bluez-5.73/emulator/serial.c:191:25: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘type’ bluez-5.73/emulator/serial.c:35:30: note: in definition of macro ‘uninitialized_var’ bluez-5.73/emulator/serial.c:35:30: note: in definition of macro ‘uninitialized_var’ # 189| } # 190| # 191|-> serial->btdev = btdev_create(type, serial->id); # 192| if (!serial->btdev) { # 193| close(serial->fd); Error: CPPCHECK_WARNING (CWE-457): bluez-5.73/emulator/serial.c:213: error[legacyUninitvar]: Uninitialized variable: dev_type # 211| { # 212| struct serial *serial; # 213|-> enum btdev_type uninitialized_var(dev_type); # 214| # 215| serial = malloc(sizeof(*serial)); Error: CLANG_WARNING: bluez-5.73/emulator/serial.c:213:2: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 211| { # 212| struct serial *serial; # 213|-> enum btdev_type uninitialized_var(dev_type); # 214| # 215| serial = malloc(sizeof(*serial)); Error: CLANG_WARNING: bluez-5.73/emulator/serial.c:213:36: warning[deadcode.DeadStores]: Value stored to 'dev_type' during its initialization is never read # 211| { # 212| struct serial *serial; # 213|-> enum btdev_type uninitialized_var(dev_type); # 214| # 215| serial = malloc(sizeof(*serial)); Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/emulator/server.c: scope_hint: In function ‘client_read_callback.part.0’ bluez-5.73/emulator/server.c:152:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*(struct client *)user_data.pkt_data + (sizetype)*(struct client *)user_data.pkt_len’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 150| # 151| if (count >= client->pkt_expect) { # 152|-> memcpy(client->pkt_data + client->pkt_len, # 153| ptr, client->pkt_expect); # 154| ptr += client->pkt_expect; Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/emulator/server.c:163:25: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘*(struct client *)user_data.pkt_data + (sizetype)*(struct client *)user_data.pkt_len’ where non-null expected <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 161| client->pkt_data = NULL; # 162| } else { # 163|-> memcpy(client->pkt_data + client->pkt_len, ptr, count); # 164| client->pkt_len += count; # 165| client->pkt_expect -= count; Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/emulator/server.c: scope_hint: In function ‘accept_client’ bluez-5.73/emulator/server.c:182:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘*(struct server *)user_data.fd’ # 180| if (getsockname(fd, (struct sockaddr *) &addr, &len) < 0) { # 181| perror("Failed to get socket name"); # 182|-> return -1; # 183| } # 184| Error: CPPCHECK_WARNING (CWE-457): bluez-5.73/emulator/server.c:200: error[legacyUninitvar]: Uninitialized variable: type # 198| struct server *server = user_data; # 199| struct client *client; # 200|-> enum btdev_type uninitialized_var(type); # 201| # 202| if (events & (EPOLLERR | EPOLLHUP)) { Error: CLANG_WARNING: bluez-5.73/emulator/server.c:200:2: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 198| struct server *server = user_data; # 199| struct client *client; # 200|-> enum btdev_type uninitialized_var(type); # 201| # 202| if (events & (EPOLLERR | EPOLLHUP)) { Error: CLANG_WARNING: bluez-5.73/emulator/server.c:200:36: warning[deadcode.DeadStores]: Value stored to 'type' during its initialization is never read # 198| struct server *server = user_data; # 199| struct client *client; # 200|-> enum btdev_type uninitialized_var(type); # 201| # 202| if (events & (EPOLLERR | EPOLLHUP)) { Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/gdbus/object.c: scope_hint: In function 'invalidate_parent_data' bluez-5.73/gdbus/object.c:696:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected bluez-5.73/gdbus/object.c: scope_hint: In function 'invalidate_parent_data' bluez-5.73/gdbus/object.c: scope_hint: In function 'invalidate_parent_data' /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. bluez-5.73/gdbus/object.c:18: included_from: Included from here. bluez-5.73/gdbus/object.c:695:23: note: in expansion of macro 'g_strdup' bluez-5.73/gdbus/object.c: scope_hint: In function 'invalidate_parent_data' bluez-5.73/gdbus/object.c:16: included_from: Included from here. /usr/include/string.h:273:14: note: argument 1 of 'strrchr' must be non-null # 694| # 695| parent_path = g_strdup(child_path); # 696|-> slash = strrchr(parent_path, '/'); # 697| if (slash == NULL) # 698| goto done; Error: CLANG_WARNING: bluez-5.73/gdbus/watch.c:204:3: warning[unix.Malloc]: Attempt to free released memory # 202| # 203| for (l = data->callbacks; l != NULL; l = l->next) # 204|-> g_free(l->data); # 205| # 206| g_slist_free(data->callbacks); Error: GCC_ANALYZER_WARNING (CWE-131): bluez-5.73/gobex/gobex-apparam.c: scope_hint: In function ‘tag_new’ bluez-5.73/gobex/gobex-apparam.c:43:15: warning[-Wanalyzer-allocation-size]: allocated buffer size is not a multiple of the pointee's size # 41| struct apparam_tag *tag; # 42| # 43|-> tag = g_malloc0(2 + len); # 44| tag->id = id; # 45| tag->len = len; Error: CLANG_WARNING: bluez-5.73/gobex/gobex-header.c:67:2: warning[core.NonNullParamChecker]: Null pointer passed to 2nd parameter expecting 'nonnull' # 65| static guint8 *put_bytes(guint8 *to, const void *from, gsize count) # 66| { # 67|-> memcpy(to, from, count); # 68| return (to + count); # 69| } Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/gobex/gobex-header.c:67:9: warning[-Wanalyzer-null-argument]: use of NULL ‘utf16’ where non-null expected bluez-5.73/gobex/gobex-header.c: scope_hint: In function ‘g_obex_header_encode’ bluez-5.73/gobex/gobex-header.c: scope_hint: In function ‘g_obex_header_encode’ /usr/include/glib-2.0/glib.h:89: included_from: Included from here. bluez-5.73/gobex/gobex-header.h:13: included_from: Included from here. bluez-5.73/gobex/gobex-header.c:16: included_from: Included from here. /usr/include/glib-2.0/glib/gtestutils.h:60:62: note: in definition of macro ‘g_assert_cmpuint’ <built-in>: scope_hint: In function ‘g_obex_header_encode’ <built-in>: note: argument 2 of ‘__builtin_memcpy’ must be non-null # 65| static guint8 *put_bytes(guint8 *to, const void *from, gsize count) # 66| { # 67|-> memcpy(to, from, count); # 68| return (to + count); # 69| } Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/gobex/gobex-header.c: scope_hint: In function ‘g_obex_header_create_list’ bluez-5.73/gobex/gobex-header.c:534:34: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘hdr’ bluez-5.73/gobex/gobex-header.c:511:25: note: in expansion of macro ‘G_OBEX_HDR_ENC’ # 532| # 533| l = g_slist_append(l, hdr); # 534|-> *total_len += hdr->hlen; # 535| id = va_arg(args, int); # 536| } Error: CLANG_WARNING: bluez-5.73/gobex/gobex-transfer.c:423:7: warning[unix.Malloc]: Use of memory after it is freed # 421| transfer_put_req_first(transfer, req, first_hdr_id, args); # 422| va_end(args); # 423|-> if (!g_slist_find(transfers, transfer)) # 424| return 0; # 425| Error: CLANG_WARNING: bluez-5.73/lib/hci.c:97:4: warning[deadcode.DeadStores]: Value stored to 'ptr' is never read # 95| while (m->str) { # 96| if ((unsigned int) m->val == val) { # 97|-> ptr += sprintf(ptr, "%s", m->str); # 98| break; # 99| } Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/lib/sdp.c: scope_hint: In function 'sdp_attr_add' bluez-5.73/lib/sdp.c:582:19: warning[-Wanalyzer-null-dereference]: dereference of NULL 'd' bluez-5.73/lib/sdp.c: scope_hint: In function 'sdp_attr_add' # 580| return -1; # 581| # 582|-> d->attrId = attr; # 583| rec->attrlist = sdp_list_insert_sorted(rec->attrlist, d, sdp_attrid_comp_func); # 584| Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/lib/sdp.c: scope_hint: In function 'sdp_connect_local' bluez-5.73/lib/sdp.c:4661:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'socket(1, 524289, 0)' # 4659| strcpy(sa.sun_path, SDP_UNIX_PATH); # 4660| # 4661|-> return connect(session->sock, (struct sockaddr *) &sa, sizeof(sa)); # 4662| } # 4663| Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/lib/sdp.c: scope_hint: In function 'sdp_connect_l2cap' bluez-5.73/lib/sdp.c:4709:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor 'socket(31, sockflags, 0)' # 4707| if (bacmp(src, BDADDR_ANY)) { # 4708| sa.l2_bdaddr = *src; # 4709|-> if (bind(sk, (struct sockaddr *) &sa, sizeof(sa)) < 0) # 4710| return -1; # 4711| } Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/lib/sdp.c:4727:27: warning[-Wanalyzer-fd-phase-mismatch]: 'connect' on file descriptor '*session.sock' in wrong phase # 4725| # 4726| do { # 4727|-> int ret = connect(sk, (struct sockaddr *) &sa, sizeof(sa)); # 4728| if (!ret) # 4729| return 0; Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/lib/sdp.c:4727:27: warning[-Wanalyzer-fd-phase-mismatch]: 'connect' on file descriptor 'socket(31, sockflags, 0)' in wrong phase # 4725| # 4726| do { # 4727|-> int ret = connect(sk, (struct sockaddr *) &sa, sizeof(sa)); # 4728| if (!ret) # 4729| return 0; Error: CLANG_WARNING: bluez-5.73/mesh/main.c:161:3: warning[deadcode.DeadStores]: Value stored to 'optarg' is never read # 159| *opts = index; # 160| # 161|-> optarg += strlen("auto"); # 162| *index = MGMT_INDEX_NONE; # 163| return true; Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/mesh/mesh-io-unit.c: scope_hint: In function ‘unit_init’ bluez-5.73/mesh/mesh-io-unit.c:238:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘*(struct mesh_io_private *)<unknown>.fd’ bluez-5.73/ell/ell.h:1: included_from: Included from here. bluez-5.73/mesh/mesh-io-unit.c:22: included_from: Included from here. bluez-5.73/mesh/mesh-io-unit.c:224:15: note: in expansion of macro ‘l_new’ # 236| strlen(pvt->addr.sun_path); # 237| # 238|-> if (bind(pvt->fd, (struct sockaddr *) &pvt->addr, size) < 0) # 239| goto fail; # 240| Error: GCC_ANALYZER_WARNING (CWE-126): bluez-5.73/mesh/net.c: scope_hint: In function ‘friend_packet_queue’ bluez-5.73/mesh/net.c:1349:25: warning[-Wanalyzer-out-of-bounds]: stack-based buffer over-read bluez-5.73/ell/ell.h:1: included_from: Included from here. bluez-5.73/mesh/net.c:19: included_from: Included from here. bluez-5.73/mesh/net.c:1198:28: note: in expansion of macro ‘l_new’ bluez-5.73/mesh/net.c:26: included_from: Included from here. bluez-5.73/mesh/net.c:1366:29: note: in expansion of macro ‘FRND_OPCODE’ bluez-5.73/mesh/net.c:1349:25: note: read of 9 bytes from after the end of ‘msg’ bluez-5.73/mesh/net.c:1349:25: note: valid subscripts for ‘msg’ are ‘[0]’ to ‘[3]’ # └───────────────────────────────────────────────────────────┘ # ^ ^ ^ # 1347| # 1348| for (i = 0; i <= seg_max; i++) { # 1349|-> memcpy(frnd_msg->u.s12[i].data, data, 12); # 1350| frnd_msg->u.s12[i].hdr = hdr; # 1351| frnd_msg->u.s12[i].seq = seqAuth + i; Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/mesh/node.c: scope_hint: In function ‘check_req_node’ bluez-5.73/mesh/node.c:1549:33: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected bluez-5.73/ell/util.h:11: included_from: Included from here. bluez-5.73/ell/ell.h:1: included_from: Included from here. bluez-5.73/mesh/node.c:21: included_from: Included from here. /usr/include/string.h:64:12: note: argument 1 of ‘memcmp’ must be non-null # 1547| node_del_comp(node, 128); # 1548| # 1549|-> if (len == node_len && !memcmp(node_comp, comp, len)) # 1550| return true; # 1551| Error: GCC_ANALYZER_WARNING (CWE-465): bluez-5.73/mesh/prov-acceptor.c: scope_hint: In function ‘acp_prov_rx’ bluez-5.73/mesh/prov-acceptor.c:685:12: warning[-Wanalyzer-deref-before-check]: check of ‘prov’ for NULL after already dereferencing it bluez-5.73/ell/ell.h:2: included_from: Included from here. bluez-5.73/mesh/prov-acceptor.c:15: included_from: Included from here. bluez-5.73/ell/log.h:90:31: note: in expansion of macro ‘L_DEBUG_SYMBOL’ bluez-5.73/mesh/prov-acceptor.c:440:9: note: in expansion of macro ‘l_debug’ # 683| } # 684| # 685|-> if (prov) # 686| prov->previous = type; # 687| return; Error: GCC_ANALYZER_WARNING (CWE-465): bluez-5.73/mesh/prov-initiator.c: scope_hint: In function ‘int_prov_rx’ bluez-5.73/mesh/prov-initiator.c:832:12: warning[-Wanalyzer-deref-before-check]: check of ‘prov’ for NULL after already dereferencing it bluez-5.73/ell/ell.h:2: included_from: Included from here. bluez-5.73/mesh/prov-initiator.c:15: included_from: Included from here. bluez-5.73/ell/log.h:90:31: note: in expansion of macro ‘L_DEBUG_SYMBOL’ bluez-5.73/mesh/prov-initiator.c:664:9: note: in expansion of macro ‘l_debug’ # 830| } # 831| # 832|-> if (prov) # 833| prov->previous = type; # 834| Error: COMPILER_WARNING: bluez-5.73/mesh/rpl.c: scope_hint: In function ‘rpl_put_entry’ bluez-5.73/mesh/rpl.c:54:41: warning[-Wformat-truncation=]: ‘%s’ directive output may be truncated writing up to 4080 bytes into a region of size between 16 and 4096 # 54 | snprintf(src_file, PATH_MAX, "%s%s/%8.8x", node_path, rpl_dir, # | ^~ /usr/include/bits/stdio2.h:68:10: note: ‘__snprintf_chk’ output between 10 and 8170 bytes into a destination of size 4096 # 68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 69 | __glibc_objsize (__s), __fmt, # | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 70 | __va_arg_pack ()); # | ~~~~~~~~~~~~~~~~~ # 52| return false; # 53| # 54|-> snprintf(src_file, PATH_MAX, "%s%s/%8.8x", node_path, rpl_dir, # 55| iv_index); # 56| dir = opendir(src_file); Error: COMPILER_WARNING: bluez-5.73/mesh/rpl.c: scope_hint: In function ‘rpl_del_entry’ bluez-5.73/mesh/rpl.c:104:41: warning[-Wformat-truncation=]: ‘%s’ directive output may be truncated writing up to 4080 bytes into a region of size between 16 and 4096 # 104 | snprintf(rpl_path, PATH_MAX, "%s%s", node_path, rpl_dir); # | ^~ /usr/include/bits/stdio2.h:68:10: note: ‘__snprintf_chk’ output between 1 and 8161 bytes into a destination of size 4096 # 68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 69 | __glibc_objsize (__s), __fmt, # | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 70 | __va_arg_pack ()); # | ~~~~~~~~~~~~~~~~~ # 102| return; # 103| # 104|-> snprintf(rpl_path, PATH_MAX, "%s%s", node_path, rpl_dir); # 105| dir = opendir(rpl_path); # 106| Error: COMPILER_WARNING: bluez-5.73/mesh/rpl.c: scope_hint: In function ‘rpl_update’ bluez-5.73/mesh/rpl.c:257:37: warning[-Wformat-truncation=]: ‘%s’ directive output may be truncated writing up to 4080 bytes into a region of size between 16 and 4096 # 257 | snprintf(path, PATH_MAX, "%s%s", node_path, rpl_dir); # | ^~ /usr/include/bits/stdio2.h:68:10: note: ‘__snprintf_chk’ output between 1 and 8161 bytes into a destination of size 4096 # 68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 69 | __glibc_objsize (__s), __fmt, # | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 70 | __va_arg_pack ()); # | ~~~~~~~~~~~~~~~~~ # 255| # 256| /* Make sure path exists */ # 257|-> snprintf(path, PATH_MAX, "%s%s", node_path, rpl_dir); # 258| if (mkdir(path, 0755) != 0 && errno != EEXIST) # 259| l_error("Failed to create dir(%d): %s", errno, path); Error: CPPCHECK_WARNING (CWE-457): bluez-5.73/mesh/rpl.c:277: error[legacyUninitvar]: Uninitialized variable: val # 275| # 276| /* Delete all invalid iv_index trees */ # 277|-> if (del || (val != cur && val != old)) { # 278| snprintf(path, PATH_MAX, "%s%s/%s", # 279| node_path, rpl_dir, entry->d_name); Error: COMPILER_WARNING: bluez-5.73/mesh/rpl.c: scope_hint: In function ‘rpl_init’ bluez-5.73/mesh/rpl.c:295:37: warning[-Wformat-truncation=]: ‘%s’ directive output may be truncated writing up to 4080 bytes into a region of size between 16 and 4096 # 295 | snprintf(path, PATH_MAX, "%s%s", node_path, rpl_dir); # | ^~ /usr/include/bits/stdio2.h:68:10: note: ‘__snprintf_chk’ output between 1 and 8161 bytes into a destination of size 4096 # 68 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, # | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 69 | __glibc_objsize (__s), __fmt, # | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # 70 | __va_arg_pack ()); # | ~~~~~~~~~~~~~~~~~ # 293| return false; # 294| # 295|-> snprintf(path, PATH_MAX, "%s%s", node_path, rpl_dir); # 296| if (mkdir(path, 0755) != 0 && errno != EEXIST) # 297| l_error("Failed to create dir(%d): %s", errno, path); Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/monitor/bnep.c: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/bnep.c:62:66: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘addr[5]’ bluez-5.73/monitor/bnep.c:30: included_from: Included from here. bluez-5.73/monitor/l2cap.h: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/l2cap.h: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/bnep.c:29: included_from: Included from here. bluez-5.73/monitor/display.h:56:17: note: in expansion of macro ‘print_indent’ bluez-5.73/monitor/bnep.c:222:9: note: in expansion of macro ‘print_field’ bluez-5.73/monitor/l2cap.h: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/l2cap.h: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/l2cap.h: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/bnep.c: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/l2cap.h: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/l2cap.h: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/l2cap.h: scope_hint: In function ‘get_macaddr’ bluez-5.73/monitor/bnep.c: scope_hint: In function ‘get_macaddr’ # 60| # 61| sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x", # 62|-> addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]); # 63| # 64| return true; Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/monitor/display.c:107:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd[0]’ # 105| # 106| if (pager_pid > 0) # 107|-> return; # 108| # 109| pager = getenv("PAGER"); Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/monitor/display.c:107:17: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd[1]’ # 105| # 106| if (pager_pid > 0) # 107|-> return; # 108| # 109| pager = getenv("PAGER"); Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/monitor/display.c:158:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘dup2(fd[1], 1)’ # 156| } # 157| # 158|-> if (dup2(fd[1], STDOUT_FILENO) < 0) { # 159| perror("Failed to duplicate pager pipe"); # 160| return; Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/monitor/display.c:164:1: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd[0]’ # 162| # 163| close_pipe(fd); # 164|-> } # 165| # 166| void close_pager(void) Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/monitor/display.c: scope_hint: In function ‘open_pager’ bluez-5.73/monitor/display.c:164:1: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘fd[1]’ # 162| # 163| close_pipe(fd); # 164|-> } # 165| # 166| void close_pager(void) Error: CLANG_WARNING: bluez-5.73/monitor/hwdb.c:59:2: warning[deadcode.DeadStores]: Value stored to 'hwdb' is never read # 57| } # 58| # 59|-> hwdb = udev_hwdb_unref(hwdb); # 60| # 61| result = true; Error: CLANG_WARNING: bluez-5.73/monitor/hwdb.c:64:2: warning[deadcode.DeadStores]: Value stored to 'udev' is never read # 62| # 63| done: # 64|-> udev = udev_unref(udev); # 65| # 66| return result; Error: CLANG_WARNING: bluez-5.73/monitor/hwdb.c:106:2: warning[deadcode.DeadStores]: Value stored to 'hwdb' is never read # 104| } # 105| # 106|-> hwdb = udev_hwdb_unref(hwdb); # 107| # 108| result = true; Error: CLANG_WARNING: bluez-5.73/monitor/hwdb.c:111:2: warning[deadcode.DeadStores]: Value stored to 'udev' is never read # 109| # 110| done: # 111|-> udev = udev_unref(udev); # 112| # 113| return result; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/monitor/jlink.c: scope_hint: In function ‘jlink_start_rtt’ bluez-5.73/monitor/jlink.c:206:13: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘tok’ # 204| # 205| tok = strtok(cfg, ","); # 206|-> if (strlen(tok)) { # 207| address = strtol(tok, NULL, 0); # 208| area_size = 0x1000; Error: CLANG_WARNING: bluez-5.73/obexd/plugins/messages-dummy.c:163:9: warning[core.NullDereference]: Access to field 'next' results in a dereference of a null pointer (loaded from variable 'cur') # 161| # 162| for (cur = list; offs < fld->offset; offs++) { # 163|-> cur = cur->next; # 164| if (cur == NULL) # 165| break; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/obexd/plugins/messages-dummy.c: scope_hint: In function ‘return_folder_listing’ bluez-5.73/obexd/plugins/messages-dummy.c:163:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘cur’ bluez-5.73/obexd/plugins/messages-dummy.c:18: included_from: Included from here. # 161| # 162| for (cur = list; offs < fld->offset; offs++) { # 163|-> cur = cur->next; # 164| if (cur == NULL) # 165| break; Error: CLANG_WARNING: bluez-5.73/obexd/plugins/vcard.c:701:6: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 699| address_fields[i++] = l->data; # 700| # 701|-> if (select_qp_encoding(format, address_fields[0], address_fields[1], # 702| address_fields[2], address_fields[3], # 703| address_fields[4], address_fields[5], Error: CLANG_WARNING: bluez-5.73/obexd/plugins/vcard.c:701:6: warning[core.CallAndMessage]: 3rd function call argument is an uninitialized value # 699| address_fields[i++] = l->data; # 700| # 701|-> if (select_qp_encoding(format, address_fields[0], address_fields[1], # 702| address_fields[2], address_fields[3], # 703| address_fields[4], address_fields[5], Error: CLANG_WARNING: bluez-5.73/obexd/plugins/vcard.c:701:6: warning[core.CallAndMessage]: 4th function call argument is an uninitialized value # 699| address_fields[i++] = l->data; # 700| # 701|-> if (select_qp_encoding(format, address_fields[0], address_fields[1], # 702| address_fields[2], address_fields[3], # 703| address_fields[4], address_fields[5], Error: CLANG_WARNING: bluez-5.73/obexd/plugins/vcard.c:701:6: warning[core.CallAndMessage]: 5th function call argument is an uninitialized value # 699| address_fields[i++] = l->data; # 700| # 701|-> if (select_qp_encoding(format, address_fields[0], address_fields[1], # 702| address_fields[2], address_fields[3], # 703| address_fields[4], address_fields[5], Error: CPPCHECK_WARNING (CWE-570): bluez-5.73/obexd/src/log.c:85: error[comparePointers]: Comparing pointers that point to different objects # 83| struct obex_debug_desc *desc; # 84| # 85|-> for (desc = __start___debug; desc < __stop___debug; desc++) # 86| desc->flags |= OBEX_DEBUG_FLAG_PRINT; # 87| } Error: CPPCHECK_WARNING (CWE-570): bluez-5.73/obexd/src/log.c:98: error[comparePointers]: Comparing pointers that point to different objects # 96| enabled = g_strsplit_set(debug, ":, ", 0); # 97| # 98|-> for (desc = __start___debug; desc < __stop___debug; desc++) { # 99| if (file != NULL || name != NULL) { # 100| if (g_strcmp0(desc->file, file) == 0) { Error: CLANG_WARNING: bluez-5.73/obexd/src/main.c:278:6: warning[core.NullDereference]: Array access (from variable 'option_root') results in a null pointer dereference # 276| } # 277| # 278|-> if (option_root[0] != '/') { # 279| const char *home = getenv("HOME"); # 280| if (home) { Error: CLANG_WARNING: bluez-5.73/obexd/src/obex.c:123:3: warning[core.NullDereference]: Access to field 'close' results in a dereference of a null pointer (loaded from field 'driver') # 121| if (os->object) { # 122| obex_object_reset_io_watch(os->object); # 123|-> os->driver->close(os->object); # 124| if (os->aborted && os->cmd == G_OBEX_OP_PUT && os->path && # 125| os->driver->remove) Error: CPPCHECK_WARNING (CWE-457): bluez-5.73/peripheral/efivars.c:82: error[uninitvar]: Uninitialized variable: attr # 80| # 81| if (attributes) # 82|-> *attributes = attr; # 83| # 84| return 0; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/profiles/audio/a2dp.c: scope_hint: In function ‘a2dp_find_eps’ bluez-5.73/profiles/audio/a2dp.c:2842:25: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 2840| # 2841| /* Prepend last used so it is preferred over others */ # 2842|-> if (chan->last_used && (chan->last_used->lsep == sep && # 2843| chan->last_used->rsep->sep == rsep)) # 2844| queue_push_head(seps, sep); Error: CLANG_WARNING: bluez-5.73/profiles/audio/avdtp.c:639:19: warning[core.NullDereference]: Access to field 'open_acp' results in a dereference of a null pointer (loaded from variable 'stream') # 637| static void stream_set_pending_open(struct avdtp_stream *stream, GIOChannel *io) # 638| { # 639|-> stream->open_acp = TRUE; # 640| stream->session->pending_open = stream; # 641| stream->session->pending_open_io = io; Error: CLANG_WARNING: bluez-5.73/profiles/audio/avdtp.c:895:25: warning[unix.Malloc]: Use of memory after it is freed # 893| req = l->data; # 894| pending_req_free(req); # 895|-> session->prio_queue = g_slist_remove(session->prio_queue, req); # 896| } # 897| Error: CLANG_WARNING: bluez-5.73/profiles/audio/avdtp.c:902:24: warning[unix.Malloc]: Use of memory after it is freed # 900| req = l->data; # 901| pending_req_free(req); # 902|-> session->req_queue = g_slist_remove(session->req_queue, req); # 903| } # 904| } Error: CLANG_WARNING: bluez-5.73/profiles/audio/avdtp.c:1716:29: warning[core.NullDereference]: Access to field 'rseid' results in a dereference of a null pointer (loaded from variable 'stream') # 1714| case AVDTP_OPEN: # 1715| case AVDTP_CLOSE: # 1716|-> check_seid_collision(req, stream->rseid); # 1717| break; # 1718| case AVDTP_START: Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/profiles/audio/avrcp.c: scope_hint: In function ‘play_status_to_val’ bluez-5.73/profiles/audio/avrcp.c:731:14: warning[-Wanalyzer-null-argument]: use of NULL ‘status’ where non-null expected bluez-5.73/profiles/audio/avrcp.c: scope_hint: In function ‘play_status_to_val’ /usr/include/string.h:462: included_from: Included from here. /usr/include/glib-2.0/glib/galloca.h:35: included_from: Included from here. /usr/include/glib-2.0/glib.h:32: included_from: Included from here. bluez-5.73/profiles/audio/avrcp.c:30: included_from: Included from here. /usr/include/strings.h:116:12: note: argument 1 of ‘strcasecmp’ must be non-null # 729| static int play_status_to_val(const char *status) # 730| { # 731|-> if (!strcasecmp(status, "stopped")) # 732| return AVRCP_PLAY_STATUS_STOPPED; # 733| else if (!strcasecmp(status, "playing")) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/profiles/audio/avrcp.c: scope_hint: In function ‘avrcp_player_event.part.0’ bluez-5.73/profiles/audio/avrcp.c:814:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘data’ bluez-5.73/profiles/audio/avrcp.c: scope_hint: In function ‘avrcp_player_event.part.0’ # 812| case AVRCP_EVENT_TRACK_CHANGED: # 813| size = 9; # 814|-> memcpy(&pdu->params[1], data, sizeof(uint64_t)); # 815| # 816| break; Error: CPPCHECK_WARNING (CWE-457): bluez-5.73/profiles/audio/avrcp.c:2343: warning[uninitvar]: Uninitialized variable: attrs # 2341| pdu->params[0] = count; # 2342| # 2343|-> memcpy(pdu->params + 1, attrs, count); # 2344| # 2345| avctp_send_vendordep_req(session->conn, AVC_CTYPE_STATUS, Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/profiles/audio/bap.c: scope_hint: In function ‘setup_create_bcast_io’ bluez-5.73/profiles/audio/bap.c:2076:38: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘setup’ # 2074| sizeof(struct bt_iso_io_qos)); # 2075| # 2076|-> if (bt_bap_pac_get_type(setup->ep->lpac) == BT_BAP_BCAST_SOURCE) # 2077| setup_connect_io_broadcast(data, setup, stream, &iso_qos, # 2078| defer); Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/profiles/audio/player.c: scope_hint: In function ‘media_player_set_setting’ bluez-5.73/profiles/audio/player.c:1359:13: warning[-Wanalyzer-null-argument]: use of NULL ‘value’ where non-null expected /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. bluez-5.73/profiles/audio/player.c:25: included_from: Included from here. bluez-5.73/profiles/audio/player.c:1350:59: note: in expansion of macro ‘g_strdup’ bluez-5.73/profiles/audio/player.c: scope_hint: In function ‘media_player_set_setting’ bluez-5.73/profiles/audio/player.c:1350:44: note: in expansion of macro ‘g_strdup’ bluez-5.73/profiles/audio/player.c: scope_hint: In function ‘media_player_set_setting’ /usr/include/string.h:462: included_from: Included from here. bluez-5.73/profiles/audio/player.c:23: included_from: Included from here. /usr/include/strings.h:116:12: note: argument 1 of ‘strcasecmp’ must be non-null # 1357| return; # 1358| # 1359|-> if (strcasecmp(value, p->value) == 0) # 1360| g_dbus_pending_property_success(p->id); # 1361| else Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/profiles/cups/hcrp.c: scope_hint: In function ‘hcrp_print’ bluez-5.73/profiles/cups/hcrp.c:213:13: warning[-Wanalyzer-fd-phase-mismatch]: ‘connect’ on file descriptor ‘ctrl_sk’ in wrong phase # 211| addr.l2_psm = htobs(ctrl_psm); # 212| # 213|-> if (connect(ctrl_sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { # 214| perror("ERROR: Can't connect to device"); # 215| close(ctrl_sk); Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/profiles/cups/main.c: scope_hint: In function ‘main’ bluez-5.73/profiles/cups/main.c:768:56: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘b[5]’ # 766| } # 767| sprintf(device, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X", # 768|-> b[0], b[1], b[2], b[3], b[4], b[5]); # 769| # 770| str2ba(device, &bdaddr); Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/profiles/cups/spp.c: scope_hint: In function ‘spp_print’ bluez-5.73/profiles/cups/spp.c:59:13: warning[-Wanalyzer-fd-phase-mismatch]: ‘connect’ on file descriptor ‘sk’ in wrong phase # 57| addr.rc_channel = channel; # 58| # 59|-> if (connect(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { # 60| perror("ERROR: Can't connect to device"); # 61| close(sk); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/adv_monitor.c: scope_hint: In function ‘monitor_process’ bluez-5.73/src/adv_monitor.c:976:48: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘*monitor.merged_pattern’ bluez-5.73/src/adv_monitor.c:36: included_from: Included from here. bluez-5.73/src/adv_monitor.c:975:35: note: in expansion of macro ‘malloc0’ # 974| # 975| monitor->merged_pattern = malloc0(sizeof(*monitor->merged_pattern)); # 976|-> monitor->merged_pattern->current_state = MERGED_PATTERN_STATE_STABLE; # 977| monitor->merged_pattern->next_state = MERGED_PATTERN_STATE_STABLE; # 978| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/adv_monitor.c:976:48: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘calloc(56, 1)’ /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. bluez-5.73/src/adv_monitor.c:20: included_from: Included from here. /usr/include/glib-2.0/glib/gstrfuncs.h:180:30: note: in definition of macro ‘g_str_has_prefix’ bluez-5.73/src/adv_monitor.c:695:19: note: in expansion of macro ‘new0’ bluez-5.73/src/adv_monitor.c:975:35: note: in expansion of macro ‘malloc0’ # 974| # 975| monitor->merged_pattern = malloc0(sizeof(*monitor->merged_pattern)); # 976|-> monitor->merged_pattern->current_state = MERGED_PATTERN_STATE_STABLE; # 977| monitor->merged_pattern->next_state = MERGED_PATTERN_STATE_STABLE; # 978| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/battery.c:234:20: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘battery’ bluez-5.73/src/log.h:60:9: note: in expansion of macro ‘DBG_IDX’ bluez-5.73/src/battery.c:222:9: note: in expansion of macro ‘DBG’ # 232| } # 233| # 234|-> if (battery->percentage == percentage) # 235| return true; # 236| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/device.c: scope_hint: In function ‘device_bonding_retry’ bluez-5.73/src/device.c:6576:29: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘data’ bluez-5.73/src/device.c: scope_hint: In function ‘device_bonding_retry’ # 6574| struct btd_device *device = data; # 6575| struct btd_adapter *adapter = device_get_adapter(device); # 6576|-> struct bonding_req *bonding = device->bonding; # 6577| uint8_t io_cap; # 6578| int err; Error: CPPCHECK_WARNING (CWE-570): bluez-5.73/src/log.c:159: error[comparePointers]: Comparing pointers that point to different objects # 157| struct btd_debug_desc *desc; # 158| # 159|-> for (desc = __start___debug; desc < __stop___debug; desc++) # 160| desc->flags |= BTD_DEBUG_FLAG_PRINT; # 161| } Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/battery.c:28: included_from: Included from here. bluez-5.73/src/battery.c: scope_hint: In function ‘btd_battery_update’ bluez-5.73/src/log.h:56:17: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘battery’ bluez-5.73/src/log.h:60:9: note: in expansion of macro ‘DBG_IDX’ bluez-5.73/src/battery.c:222:9: note: in expansion of macro ‘DBG’ bluez-5.73/src/log.h:60:9: note: in expansion of macro ‘DBG_IDX’ bluez-5.73/src/battery.c:222:9: note: in expansion of macro ‘DBG’ bluez-5.73/src/log.h:60:9: note: in expansion of macro ‘DBG_IDX’ bluez-5.73/src/battery.c:222:9: note: in expansion of macro ‘DBG’ bluez-5.73/src/log.h:60:9: note: in expansion of macro ‘DBG_IDX’ bluez-5.73/src/battery.c:222:9: note: in expansion of macro ‘DBG’ # 54| }; \ # 55| if (__btd_debug_desc.flags & BTD_DEBUG_FLAG_PRINT) \ # 56|-> btd_debug(idx, fmt, ## arg); \ # 57| } while (0) # 58| Error: CLANG_WARNING: bluez-5.73/src/oui.c:50:2: warning[deadcode.DeadStores]: Value stored to 'hwdb' is never read # 48| } # 49| # 50|-> hwdb = udev_hwdb_unref(hwdb); # 51| # 52| done: Error: CLANG_WARNING: bluez-5.73/src/oui.c:53:2: warning[deadcode.DeadStores]: Value stored to 'udev' is never read # 51| # 52| done: # 53|-> udev = udev_unref(udev); # 54| # 55| return comp; Error: CLANG_WARNING: bluez-5.73/src/sdp-client.c:353:14: warning[core.NullDereference]: Access to field 'cb' results in a dereference of a null pointer # 351| return err; # 352| # 353|-> (*ctxt)->cb = cb; # 354| (*ctxt)->destroy = destroy; # 355| (*ctxt)->user_data = user_data; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/sdp-client.c:353:21: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ bluez-5.73/src/sdp-client.c: scope_hint: In function ‘bt_search_service’ bluez-5.73/src/sdp-client.c: scope_hint: In function ‘bt_search_service’ bluez-5.73/src/sdp-client.c:15: included_from: Included from here. # 351| return err; # 352| # 353|-> (*ctxt)->cb = cb; # 354| (*ctxt)->destroy = destroy; # 355| (*ctxt)->user_data = user_data; Error: CLANG_WARNING: bluez-5.73/src/sdp-xml.c:126:10: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 124| # 125| buf[0] = data[i]; # 126|-> buf[1] = data[i + 1]; # 127| # 128| val.data[j++] = strtoul(buf, 0, 16); Error: CLANG_WARNING: bluez-5.73/src/sdp-xml.c:300:11: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 298| for (; i < 32; i += 2) { # 299| buf[0] = data[i]; # 300|-> buf[1] = data[i + 1]; # 301| # 302| val.data[i >> 1] = strtoul(buf, 0, 16); Error: CLANG_WARNING: bluez-5.73/src/sdp-xml.c:338:11: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 336| for (i = 0; i < len; i += 2) { # 337| buf[0] = data[i]; # 338|-> buf[1] = data[i + 1]; # 339| # 340| decoded[i >> 1] = strtoul(buf, 0, 16); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/sdp-xml.c: scope_hint: In function ‘element_start.part.0’ bluez-5.73/src/sdp-xml.c:461:31: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 459| if (ctx_data->stack_head) { # 460| struct sdp_xml_data *newelem = sdp_xml_data_alloc(); # 461|-> newelem->next = ctx_data->stack_head; # 462| ctx_data->stack_head = newelem; # 463| } else { Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/sdp-xml.c:465:44: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘0’ # 463| } else { # 464| ctx_data->stack_head = sdp_xml_data_alloc(); # 465|-> ctx_data->stack_head->next = NULL; # 466| } # 467| Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘sdp_cstate_alloc_buf’ bluez-5.73/src/sdpd-request.c:105:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘data’ where non-null expected bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘sdp_cstate_alloc_buf’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘sdp_cstate_alloc_buf’ bluez-5.73/src/shared/util.h:214:16: note: in expansion of macro ‘be16_to_cpu’ bluez-5.73/src/shared/util.h:214:28: note: in expansion of macro ‘get_unaligned’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘sdp_cstate_alloc_buf’ <built-in>: note: argument 1 of ‘__builtin_memcpy’ must be non-null # 103| uint8_t *data = malloc(buf->data_size); # 104| # 105|-> memcpy(data, buf->data, buf->data_size); # 106| memset(cinfo, 0, sizeof(sdp_cont_info_t)); # 107| cinfo->buf.data = data; Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/sdpd-request.c:106:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘cinfo’ where non-null expected bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘sdp_cstate_alloc_buf’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘sdp_cstate_alloc_buf’ bluez-5.73/src/shared/util.h:214:16: note: in expansion of macro ‘be16_to_cpu’ bluez-5.73/src/shared/util.h:214:28: note: in expansion of macro ‘get_unaligned’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘sdp_cstate_alloc_buf’ <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 104| # 105| memcpy(data, buf->data, buf->data_size); # 106|-> memset(cinfo, 0, sizeof(sdp_cont_info_t)); # 107| cinfo->buf.data = data; # 108| cinfo->buf.data_size = buf->data_size; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/sdpd-request.c:203:42: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘aid’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/shared/util.h:238:16: note: in expansion of macro ‘be32_to_cpu’ bluez-5.73/src/shared/util.h:238:28: note: in expansion of macro ‘get_unaligned’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/shared/util.h:214:16: note: in expansion of macro ‘be16_to_cpu’ bluez-5.73/src/shared/util.h:214:28: note: in expansion of macro ‘get_unaligned’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ # 201| struct attrid *aid; # 202| aid = malloc(sizeof(struct attrid)); # 203|-> aid->dtd = dataType; # 204| aid->uint16 = get_be16(p); # 205| pElem = (char *) aid; Error: CLANG_WARNING: bluez-5.73/src/sdpd-request.c:211:13: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint16_t' # 209| memcpy(&tmp, p, sizeof(tmp)); # 210| # 211|-> pElem = malloc(sizeof(uint16_t)); # 212| put_be16(tmp, pElem); # 213| } Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/sdpd-request.c:230:42: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘aid’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/shared/util.h:238:16: note: in expansion of macro ‘be32_to_cpu’ bluez-5.73/src/shared/util.h:238:28: note: in expansion of macro ‘get_unaligned’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/shared/util.h:214:16: note: in expansion of macro ‘be16_to_cpu’ bluez-5.73/src/shared/util.h:214:28: note: in expansion of macro ‘get_unaligned’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ # 228| struct attrid *aid; # 229| aid = malloc(sizeof(struct attrid)); # 230|-> aid->dtd = dataType; # 231| aid->uint32 = get_be32(p); # 232| Error: CLANG_WARNING: bluez-5.73/src/sdpd-request.c:239:13: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'char', which is incompatible with sizeof operand type 'uint32_t' # 237| memcpy(&tmp, p, sizeof(tmp)); # 238| # 239|-> pElem = malloc(sizeof(uint32_t)); # 240| put_be32(tmp, pElem); # 241| } Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘process_request’ bluez-5.73/src/sdpd-request.c:1017:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘buf’ where non-null expected bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘process_request’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘process_request’ <built-in>: note: argument 1 of ‘__builtin_memset’ must be non-null # 1015| int status = SDP_INVALID_SYNTAX; # 1016| # 1017|-> memset(buf, 0, USHRT_MAX); # 1018| rsp.data = buf + sizeof(sdp_pdu_hdr_t); # 1019| rsp.data_size = 0; Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/ad.c: scope_hint: In function 'ad_replace_data' bluez-5.73/src/shared/ad.c:394:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected bluez-5.73/src/shared/ad.c:26: included_from: Included from here. bluez-5.73/src/shared/ad.c:389:58: note: in expansion of macro 'UINT_TO_PTR' <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 392| return false; # 393| new_data->data = realloc(new_data->data, len); # 394|-> memcpy(new_data->data, data, len); # 395| new_data->len = len; # 396| return true; Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/ad.c: scope_hint: In function 'bt_ad_add_manufacturer_data' bluez-5.73/src/shared/ad.c:847:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected bluez-5.73/src/shared/ad.c:842:49: note: in expansion of macro 'UINT_TO_PTR' <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 845| return false; # 846| new_data->data = realloc(new_data->data, len); # 847|-> memcpy(new_data->data, data, len); # 848| new_data->len = len; # 849| return true; Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/ad.c: scope_hint: In function 'bt_ad_add_service_data' bluez-5.73/src/shared/ad.c:983:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 981| return false; # 982| new_data->data = realloc(new_data->data, len); # 983|-> memcpy(new_data->data, data, len); # 984| new_data->len = len; # 985| return true; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/bap.c: scope_hint: In function 'bap_stream_io_attach' bluez-5.73/src/shared/bap.c:40:9: warning[-Wanalyzer-null-dereference]: dereference of NULL 'stream' bluez-5.73/src/shared/bap.c:2175:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/bap.c:2175:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/bap.c:2175:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/bap.c:2175:9: note: in expansion of macro 'DBG' # 38| #define ASE_UUID(_id) (_id < NUM_SINKS ? ASE_SINK_UUID : ASE_SOURCE_UUID) # 39| #define DBG(_bap, fmt, arg...) \ # 40|-> bap_debug(_bap, "%s:%s() " fmt, __FILE__, __func__, ## arg) # 41| # 42| #define LTV(_type, _bytes...) \ Error: GCC_ANALYZER_WARNING (CWE-401): bluez-5.73/src/shared/bap.c: scope_hint: In function 'iov_append' bluez-5.73/src/shared/bap.c:332:16: warning[-Wanalyzer-malloc-leak]: leak of '*iov.iov_base' # 330| { # 331| iov->iov_base = realloc(iov->iov_base, iov->iov_len + len); # 332|-> return util_iov_push_mem(iov, len, d); # 333| } # 334| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/bap.c: scope_hint: In function 'bap_get_session.part.0' bluez-5.73/src/shared/bap.c:645:18: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 643| # 644| bap = bt_bap_new(db, NULL); # 645|-> bap->att = att; # 646| # 647| bt_bap_attach(bap, NULL); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/bap.c: scope_hint: In function 'bap_cp_attach' bluez-5.73/src/shared/bap.c:4555:50: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 4553| struct bt_ascs *ascs = bap_get_ascs(bap); # 4554| # 4555|-> if (!gatt_db_attribute_get_char_data(ascs->ase_cp, NULL, # 4556| &value_handle, # 4557| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/bap.c: scope_hint: In function 'foreach_ascs_service' bluez-5.73/src/shared/bap.c:4620:23: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 4618| struct bt_ascs *ascs = bap_get_ascs(bap); # 4619| # 4620|-> ascs->service = attr; # 4621| # 4622| gatt_db_service_set_claimed(attr, true); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/bass.c: scope_hint: In function 'bass_build_bcast_src' bluez-5.73/src/shared/bass.c:294:17: warning[-Wanalyzer-null-dereference]: dereference of NULL 'bad_code' # 292| # 293| if (enc == BT_BASS_BIG_ENC_STATE_BAD_CODE) # 294|-> memcpy(bcast_src->bad_code, bad_code, BT_BASS_BCAST_CODE_SIZE); # 295| else # 296| memset(bcast_src->bad_code, 0, BT_BASS_BCAST_CODE_SIZE); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/bass.c: scope_hint: In function 'bass_get_session.part.0' bluez-5.73/src/shared/bass.c:755:19: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 753| # 754| bass = bt_bass_new(db, NULL, adapter_bdaddr); # 755|-> bass->att = att; # 756| # 757| bt_bass_attach(bass, NULL); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_incom_call_attach' bluez-5.73/src/shared/ccp.c:661:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:659:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:659:9: note: in expansion of macro 'DBG' # 659| DBG(ccp, ""); # 660| # 661|-> if (!gatt_db_attribute_get_char_data(ccs->incoming_call, NULL, # 662| &value_handle, # 663| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_call_state_attach' bluez-5.73/src/shared/ccp.c:683:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:681:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:681:9: note: in expansion of macro 'DBG' # 681| DBG(ccp, ""); # 682| # 683|-> if (!gatt_db_attribute_get_char_data(ccs->call_state, NULL, # 684| &value_handle, # 685| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_call_list_attach' bluez-5.73/src/shared/ccp.c:705:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:703:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:703:9: note: in expansion of macro 'DBG' # 703| DBG(ccp, ""); # 704| # 705|-> if (!gatt_db_attribute_get_char_data(ccs->current_call_list, NULL, # 706| &value_handle, # 707| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_name_attach' bluez-5.73/src/shared/ccp.c:727:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:725:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:725:9: note: in expansion of macro 'DBG' # 725| DBG(ccp, ""); # 726| # 727|-> if (!gatt_db_attribute_get_char_data(ccs->bearer_name, NULL, # 728| &value_handle, # 729| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_term_reason_attach' bluez-5.73/src/shared/ccp.c:749:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:747:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:747:9: note: in expansion of macro 'DBG' # 747| DBG(ccp, ""); # 748| # 749|-> if (!gatt_db_attribute_get_char_data(ccs->termination_reason, NULL, # 750| &value_handle, NULL, NULL, NULL)) # 751| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_status_attach' bluez-5.73/src/shared/ccp.c:770:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:768:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:768:9: note: in expansion of macro 'DBG' # 768| DBG(ccp, ""); # 769| # 770|-> if (!gatt_db_attribute_get_char_data(ccs->status_flag, NULL, # 771| &value_handle, # 772| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_uci_attach' bluez-5.73/src/shared/ccp.c:792:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:790:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:790:9: note: in expansion of macro 'DBG' # 790| DBG(ccp, ""); # 791| # 792|-> if (!gatt_db_attribute_get_char_data(ccs->bearer_uci, NULL, # 793| &value_handle, # 794| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_technology_attach' bluez-5.73/src/shared/ccp.c:813:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:811:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:811:9: note: in expansion of macro 'DBG' # 811| DBG(ccp, ""); # 812| # 813|-> if (!gatt_db_attribute_get_char_data(ccs->bearer_technology, NULL, # 814| &value_handle, # 815| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_strength_attach' bluez-5.73/src/shared/ccp.c:833:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:831:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:831:9: note: in expansion of macro 'DBG' # 831| DBG(ccp, ""); # 832| # 833|-> if (!gatt_db_attribute_get_char_data(ccs->signal_strength, NULL, # 834| &value_handle, # 835| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_ccid_attach' bluez-5.73/src/shared/ccp.c:853:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:851:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:851:9: note: in expansion of macro 'DBG' # 851| DBG(ccp, ""); # 852| # 853|-> if (!gatt_db_attribute_get_char_data(ccs->ccid, NULL, &value_handle, # 854| NULL, NULL, NULL)) # 855| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_tar_uri_attach' bluez-5.73/src/shared/ccp.c:872:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:870:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:870:9: note: in expansion of macro 'DBG' # 870| DBG(ccp, ""); # 871| # 872|-> if (!gatt_db_attribute_get_char_data(ccs->target_bearer_uri, NULL, # 873| &value_handle, # 874| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_ctrl_point_attach' bluez-5.73/src/shared/ccp.c:893:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:891:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:891:9: note: in expansion of macro 'DBG' # 891| DBG(ccp, ""); # 892| # 893|-> if (!gatt_db_attribute_get_char_data(ccs->call_ctrl_point, NULL, # 894| &value_handle, # 895| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_ctrl_opcode_attach' bluez-5.73/src/shared/ccp.c:913:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:911:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:911:9: note: in expansion of macro 'DBG' # 911| DBG(ccp, ""); # 912| # 913|-> if (!gatt_db_attribute_get_char_data(ccs->call_ctrl_opt_opcode, NULL, # 914| &value_handle, # 915| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_friendly_name_attach' bluez-5.73/src/shared/ccp.c:933:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:931:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:931:9: note: in expansion of macro 'DBG' # 931| DBG(ccp, ""); # 932| # 933|-> if (!gatt_db_attribute_get_char_data(ccs->friendly_name, NULL, # 934| &value_handle, # 935| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_signal_intrvl_attach' bluez-5.73/src/shared/ccp.c:953:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:951:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:951:9: note: in expansion of macro 'DBG' # 951| DBG(ccp, ""); # 952| # 953|-> if (!gatt_db_attribute_get_char_data(ccs->signal_reporting_intrvl, NULL, # 954| &value_handle, # 955| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'bt_ccp_uri_list_attach' bluez-5.73/src/shared/ccp.c:973:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/ccp.c:971:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/ccp.c:971:9: note: in expansion of macro 'DBG' # 971| DBG(ccp, ""); # 972| # 973|-> if (!gatt_db_attribute_get_char_data(ccs->bearer_uri_schemes_list, NULL, # 974| &value_handle, # 975| NULL, NULL, NULL)) Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/ccp.c: scope_hint: In function 'foreach_ccs_service' bluez-5.73/src/shared/ccp.c:1129:22: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1127| struct bt_ccs *ccs = ccp_get_ccs(ccp); # 1128| # 1129|-> ccs->service = attr; # 1130| # 1131| gatt_db_service_foreach_char(attr, foreach_ccs_char, ccp); Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/src/shared/crypto.c: scope_hint: In function 'alg_new' bluez-5.73/src/shared/crypto.c:212:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor '*crypto.cmac_aes' # 210| # 211| /* FIXME: This should use accept4() with SOCK_CLOEXEC */ # 212|-> return accept(fd, NULL, 0); # 213| } # 214| Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/src/shared/crypto.c:212:16: warning[-Wanalyzer-fd-leak]: leak of file descriptor '*crypto.ecb_aes' bluez-5.73/src/shared/crypto.c: scope_hint: In function 'alg_new' # 210| # 211| /* FIXME: This should use accept4() with SOCK_CLOEXEC */ # 212|-> return accept(fd, NULL, 0); # 213| } # 214| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/csip.c: scope_hint: In function 'foreach_csis_service' bluez-5.73/src/shared/csip.c:605:23: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 603| struct bt_csis *csis = csip_get_csis(csip); # 604| # 605|-> csis->service = attr; # 606| # 607| gatt_db_service_set_claimed(attr, true); Error: GCC_ANALYZER_WARNING (CWE-416): bluez-5.73/src/shared/gatt-client.c: scope_hint: In function 'request_unref' bluez-5.73/src/shared/gatt-client.c:199:32: warning[-Wanalyzer-use-after-free]: use after 'free' of 'data' # 197| { # 198| struct request *req = data; # 199|-> struct bt_gatt_client *client = req->client; # 200| # 201| if (__sync_sub_and_fetch(&req->ref_count, 1)) Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:451:21: warning[unix.Malloc]: Use of memory after it is freed # 449| * range. # 450| */ # 451|-> gatt_db_unregister(op->client->db, op->db_id); # 452| op->db_id = 0; # 453| Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:696:2: warning[unix.Malloc]: Use of memory after it is freed # 694| discovery_op_unref(op); # 695| failed: # 696|-> discovery_op_complete(op, false, att_ecode); # 697| } # 698| Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:993:2: warning[unix.Malloc]: Use of memory after it is freed # 991| # 992| done: # 993|-> discovery_op_complete(op, success, att_ecode); # 994| } # 995| Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:1099:2: warning[unix.Malloc]: Use of memory after it is freed # 1097| # 1098| done: # 1099|-> discovery_op_complete(op, success, att_ecode); # 1100| } # 1101| Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:1291:2: warning[unix.Malloc]: Use of memory after it is freed # 1289| # 1290| done: # 1291|-> discovery_op_complete(op, success, att_ecode); # 1292| } # 1293| Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:1356:2: warning[unix.Malloc]: Use of memory after it is freed # 1354| # 1355| done: # 1356|-> discovery_op_complete(op, success, att_ecode); # 1357| } # 1358| Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:1631:6: warning[unix.Malloc]: Use of memory after it is freed # 1629| read_server_feat(op); # 1630| # 1631|-> if (read_db_hash(op)) { # 1632| op->success = false; # 1633| return; Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:1636:2: warning[unix.Malloc]: Use of memory after it is freed # 1634| } # 1635| # 1636|-> discover_all(op); # 1637| } # 1638| Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:2140:6: warning[unix.Malloc]: Use of memory after it is freed # 2138| read_server_feat(op); # 2139| # 2140|-> if (read_db_hash(op)) { # 2141| op->success = false; # 2142| goto done; Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:2148:8: warning[unix.Malloc]: Use of memory after it is freed # 2146| client->att, NULL, # 2147| discover_primary_cb, # 2148|-> discovery_op_ref(op), # 2149| discovery_op_unref); # 2150| if (!client->discovery_req) { Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/src/shared/gatt-client.c: scope_hint: In function 'bt_gatt_client_write_value' bluez-5.73/src/shared/gatt-client.c:3151:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'value' bluez-5.73/src/shared/gatt-client.c:19: included_from: Included from here. bluez-5.73/src/shared/gatt-client.c:3755:57: note: in expansion of macro 'UINT_TO_PTR' bluez-5.73/src/shared/gatt-client.c:24: included_from: Included from here. bluez-5.73/src/shared/gatt-client.c: scope_hint: In function 'bt_gatt_client_write_value' bluez-5.73/src/shared/gatt-client.c:3135:14: note: in expansion of macro 'new0' bluez-5.73/src/shared/gatt-client.c:145:15: note: in expansion of macro 'new0' # 3149| # 3150| put_le16(value_handle, pdu); # 3151|-> memcpy(pdu + 2, value, length); # 3152| # 3153| req->att_id = bt_att_send(client->att, BT_ATT_OP_WRITE_REQ, Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:3237:2: warning[unix.Malloc]: Use of memory after it is freed # 3235| # 3236| done: # 3237|-> complete_write_long_op(req, success, 0, false); # 3238| } # 3239| Error: CLANG_WARNING: bluez-5.73/src/shared/gatt-client.c:3259:2: warning[unix.Malloc]: Use of memory after it is freed # 3257| * necessary, since we also added a ref before pushing to the queue. # 3258| */ # 3259|-> request_unref(req); # 3260| } # 3261| Error: GCC_ANALYZER_WARNING (CWE-416): bluez-5.73/src/shared/gatt-client.c: scope_hint: In function 'complete_write_long_op' bluez-5.73/src/shared/gatt-client.c:3290:31: warning[-Wanalyzer-use-after-free]: use after 'free' of 'req' # 3288| uint8_t att_ecode, bool reliable_error) # 3289| { # 3290|-> struct long_write_op *op = req->data; # 3291| uint8_t pdu; # 3292| int err; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/gatt-db.c: scope_hint: In function 'read_ext_prop_value' bluez-5.73/src/shared/gatt-db.c:1812:37: warning[-Wanalyzer-null-dereference]: dereference of NULL 'value' # 1810| return; # 1811| # 1812|-> *ext_prop = (uint16_t) value[0]; # 1813| } # 1814| Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/src/shared/gatt-server.c: scope_hint: In function 'read_by_grp_type_cb' bluez-5.73/src/shared/gatt-server.c:322:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'type' bluez-5.73/src/shared/att.h:11: included_from: Included from here. bluez-5.73/src/shared/gatt-server.c:19: included_from: Included from here. bluez-5.73/src/shared/gatt-server.c:295:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/gatt-server.c:295:9: note: in expansion of macro 'DBG' # 320| } # 321| # 322|-> gatt_db_read_by_group_type(server->db, start, end, type, q); # 323| # 324| if (queue_isempty(q)) { Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/src/shared/gatt-server.c: scope_hint: In function 'read_by_type_cb' bluez-5.73/src/shared/gatt-server.c:531:9: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'type' # 529| } # 530| # 531|-> gatt_db_read_by_type(server->db, start, end, type, q); # 532| # 533| if (queue_isempty(q)) { Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/gatt-server.c: scope_hint: In function 'prep_write_cb' bluez-5.73/src/shared/gatt-server.c:1350:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'malloc((long unsigned int)length)' where non-null expected bluez-5.73/src/shared/util.h:26:27: note: in definition of macro 'le16_to_cpu' bluez-5.73/src/shared/util.h:209:28: note: in expansion of macro 'get_unaligned' bluez-5.73/src/shared/gatt-server.c: scope_hint: In function 'prep_write_cb' bluez-5.73/src/shared/gatt-server.c:1337:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/gatt-server.c:1337:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/gatt-server.c:1337:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/gatt-server.c: scope_hint: In function 'prep_write_cb' bluez-5.73/src/shared/gatt-server.c:1347:16: note: in expansion of macro 'new0' <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 1348| pwcd->chan = chan; # 1349| pwcd->pdu = malloc(length); # 1350|-> memcpy(pwcd->pdu, pdu, length); # 1351| pwcd->length = length; # 1352| pwcd->server = server; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'mcp_send' bluez-5.73/src/shared/mcp.c:586:17: warning[-Wanalyzer-null-dereference]: dereference of NULL 'mcp' bluez-5.73/src/shared/mcp.c:584:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/mcp.c:584:9: note: in expansion of macro 'DBG' # 584| DBG(mcp, "mcs %p", mcs); # 585| # 586|-> if (!mcp->client) # 587| return -1; # 588| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_mp_name_attach' bluez-5.73/src/shared/mcp.c:1008:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1006| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1007| # 1008|-> if (!gatt_db_attribute_get_char_data(mcs->mp_name, NULL, &value_handle, # 1009| NULL, NULL, NULL)) # 1010| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_track_changed_attach' bluez-5.73/src/shared/mcp.c:1026:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1024| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1025| # 1026|-> if (!gatt_db_attribute_get_char_data(mcs->track_changed, NULL, # 1027| &value_handle, NULL, NULL, NULL)) # 1028| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_track_title_attach' bluez-5.73/src/shared/mcp.c:1042:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1040| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1041| # 1042|-> if (!gatt_db_attribute_get_char_data(mcs->track_title, NULL, # 1043| &value_handle, NULL, NULL, NULL)) # 1044| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_track_duration_attach' bluez-5.73/src/shared/mcp.c:1060:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1058| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1059| # 1060|-> if (!gatt_db_attribute_get_char_data(mcs->track_duration, NULL, # 1061| &value_handle, NULL, NULL, NULL)) # 1062| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_track_position_attach' bluez-5.73/src/shared/mcp.c:1078:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1076| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1077| # 1078|-> if (!gatt_db_attribute_get_char_data(mcs->track_position, NULL, # 1079| &value_handle, NULL, NULL, NULL)) # 1080| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_media_state_attach' bluez-5.73/src/shared/mcp.c:1096:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1094| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1095| # 1096|-> if (!gatt_db_attribute_get_char_data(mcs->media_state, NULL, # 1097| &value_handle, NULL, NULL, NULL)) # 1098| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_media_cp_attach' bluez-5.73/src/shared/mcp.c:1114:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1112| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1113| # 1114|-> if (!gatt_db_attribute_get_char_data(mcs->media_cp, NULL, # 1115| &value_handle, NULL, NULL, NULL)) # 1116| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_media_cp_op_supported_attach' bluez-5.73/src/shared/mcp.c:1130:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1128| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1129| # 1130|-> if (!gatt_db_attribute_get_char_data(mcs->media_cp_op_supportd, NULL, # 1131| &value_handle, NULL, NULL, NULL)) # 1132| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'bt_mcp_content_control_id_supported_attach' bluez-5.73/src/shared/mcp.c:1149:49: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 1147| struct bt_mcs *mcs = mcp_get_mcs(mcp); # 1148| # 1149|-> if (!gatt_db_attribute_get_char_data(mcs->content_control_id, NULL, # 1150| &value_handle, NULL, NULL, NULL)) # 1151| return; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/mcp.c: scope_hint: In function 'foreach_mcs_service' bluez-5.73/src/shared/mcp.c:1313:22: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/mcp.c:1311:9: note: in expansion of macro 'DBG' bluez-5.73/src/shared/mcp.c:1311:9: note: in expansion of macro 'DBG' # 1311| DBG(mcp, ""); # 1312| # 1313|-> mcs->service = attr; # 1314| # 1315| gatt_db_service_foreach_char(attr, foreach_mcs_char, mcp); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/micp.c: scope_hint: In function 'micp_get_session' bluez-5.73/src/shared/micp.c:271:19: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 269| # 270| micp = bt_micp_new(db, NULL); # 271|-> micp->att = att; # 272| # 273| bt_att_register_disconnect(att, micp_disconnected, micp, NULL); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/micp.c: scope_hint: In function 'mics_muted' bluez-5.73/src/shared/micp.c:339:21: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/micp.c: scope_hint: In function 'mics_muted' bluez-5.73/src/shared/micp.c: scope_hint: In function 'mics_muted' # 337| mute_state = mdb_get_mute_state(mdb); # 338| # 339|-> *mute_state = MICS_MUTED; # 340| # 341| gatt_db_attribute_notify(mdb->mics->ms, (void *)mute_state, Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/micp.c: scope_hint: In function 'mics_mute_write' bluez-5.73/src/shared/micp.c:417:13: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/micp.c: scope_hint: In function 'mics_mute_write' bluez-5.73/src/shared/micp.c: scope_hint: In function 'mics_mute_write' bluez-5.73/src/shared/micp.c: scope_hint: In function 'mics_mute_write' # 415| # 416| mute_state = mdb_get_mute_state(mdb); # 417|-> if (*mute_state == MICS_DISABLED) { # 418| DBG(micp, "state: MICS DISABLED , can not write value: %d", # 419| *micp_op); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/micp.c: scope_hint: In function 'foreach_mics_service' bluez-5.73/src/shared/micp.c:782:23: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 780| struct bt_mics *mics = micp_get_mics(micp); # 781| # 782|-> mics->service = attr; # 783| # 784| gatt_db_service_set_claimed(attr, true); Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/src/shared/shell.c: scope_hint: In function 'bt_shell_printf' bluez-5.73/src/shared/shell.c:578:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value 'saved_line' bluez-5.73/src/shared/shell.c:29: included_from: Included from here. # 576| if (!data.saved_prompt) # 577| rl_restore_prompt(); # 578|-> rl_replace_line(saved_line, 0); # 579| rl_point = saved_point; # 580| rl_forced_update_display(); Error: CLANG_WARNING: bluez-5.73/src/shared/shell.c:1228:13: warning[core.NullDereference]: Access to field 'options' results in a dereference of a null pointer (loaded from variable 'opt') # 1226| } # 1227| # 1228|-> if (c != opt->options[index - offset].val) { # 1229| usage(argc, argv, opt); # 1230| exit(EXIT_SUCCESS); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/tester.c: scope_hint: In function 'tester_setup_io' bluez-5.73/src/shared/tester.c:1009:19: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/tester.c: scope_hint: In function 'tester_setup_io' # 1007| } # 1008| # 1009|-> test->iov = iov; # 1010| test->iovcnt = iovcnt; # 1011| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/tester.c: scope_hint: In function 'tester_io_send' bluez-5.73/src/shared/tester.c:1019:17: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/tester.c: scope_hint: In function 'tester_io_send' # 1017| struct test_case *test = tester_get_test(); # 1018| # 1019|-> if (test->iovcnt) # 1020| io_set_write_handler(ios[1], test_io_send, NULL, NULL); # 1021| } Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/tester.c: scope_hint: In function 'tester_io_set_complete_func' bluez-5.73/src/shared/tester.c:1027:32: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' bluez-5.73/src/shared/tester.c: scope_hint: In function 'tester_io_set_complete_func' # 1025| struct test_case *test = tester_get_test(); # 1026| # 1027|-> test->io_complete_func = func; # 1028| } # 1029| Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/util.c: scope_hint: In function 'util_iov_memcpy.part.0' bluez-5.73/src/shared/util.c:379:9: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected <built-in>: note: argument 1 of '__builtin_memcpy' must be non-null # 377| iov->iov_base = realloc(iov->iov_base, len); # 378| iov->iov_len = len; # 379|-> memcpy(iov->iov_base, src, len); # 380| } # 381| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/util.c: scope_hint: In function 'strdelimit' bluez-5.73/src/shared/util.c:1820:16: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'dup' # 1818| # 1819| dup = strdup(str); # 1820|-> if (dup[0] == '\0') # 1821| return dup; # 1822| Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/src/shared/util.h:60:12: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘*(struct <anonymous> *)(&mic[0]).__v’ bluez-5.73/src/shared/util.h:238:16: note: in expansion of macro ‘be32_to_cpu’ bluez-5.73/src/shared/util.h:238:28: note: in expansion of macro ‘get_unaligned’ bluez-5.73/tools/mesh-gatt/crypto.c: scope_hint: In function ‘mesh_crypto_aes_ccm_decrypt’ bluez-5.73/src/shared/util.h:68:21: note: in definition of macro ‘put_unaligned’ bluez-5.73/src/shared/util.h:285:23: note: in expansion of macro ‘cpu_to_be32’ bluez-5.73/tools/mesh-gatt/crypto.c: scope_hint: In function ‘mesh_crypto_aes_ccm_decrypt’ bluez-5.73/tools/mesh-gatt/crypto.c: scope_hint: In function ‘mesh_crypto_aes_ccm_decrypt’ bluez-5.73/src/shared/util.h:238:16: note: in expansion of macro ‘be32_to_cpu’ bluez-5.73/src/shared/util.h:238:28: note: in expansion of macro ‘get_unaligned’ bluez-5.73/src/shared/util.h:238:16: note: in expansion of macro ‘be32_to_cpu’ bluez-5.73/src/shared/util.h:238:28: note: in expansion of macro ‘get_unaligned’ # 58| __typeof__(*(ptr)) __v; \ # 59| } *__p = (__typeof__(__p)) (ptr); \ # 60|-> __p->__v; \ # 61| }) # 62| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/util.h:68:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'data' bluez-5.73/src/shared/util.h:258:9: note: in expansion of macro 'put_unaligned' bluez-5.73/src/shared/gatt-db.c: scope_hint: In function 'gen_hash_m.part.0' bluez-5.73/src/shared/util.h:258:9: note: in expansion of macro 'put_unaligned' # 66| __typeof__(*(ptr)) __v; \ # 67| } *__p = (__typeof__(__p)) (ptr); \ # 68|-> __p->__v = (val); \ # 69| } while (0) # 70| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/util.h:68:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘pElem’ bluez-5.73/src/shared/util.h:263:9: note: in expansion of macro ‘put_unaligned’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/sdpd-request.c: scope_hint: In function ‘extract_des’ bluez-5.73/src/shared/util.h:263:9: note: in expansion of macro ‘put_unaligned’ # 66| __typeof__(*(ptr)) __v; \ # 67| } *__p = (__typeof__(__p)) (ptr); \ # 68|-> __p->__v = (val); \ # 69| } while (0) # 70| Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/util.c:39: included_from: Included from here. bluez-5.73/src/shared/util.c: scope_hint: In function 'util_iov_dup' bluez-5.73/src/shared/util.h:83:17: warning[-Wanalyzer-null-argument]: use of NULL where non-null expected bluez-5.73/src/shared/util.c:350:15: note: in expansion of macro 'new0' bluez-5.73/src/shared/util.c:350:15: note: in expansion of macro 'new0' bluez-5.73/src/shared/util.c:350:15: note: in expansion of macro 'new0' bluez-5.73/src/shared/util.c:350:15: note: in expansion of macro 'new0' bluez-5.73/src/shared/util.c:350:15: note: in expansion of macro 'new0' <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 81| void *__p; \ # 82| __p = util_malloc(__n * __s); \ # 83|-> memset(__p, 0, __n * __s); \ # 84| __p; \ # 85| })) Error: CLANG_WARNING: bluez-5.73/tools/mesh-gatt/crypto.c:32: included_from: Included from here. bluez-5.73/src/shared/util.h:238:9: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 236| static inline uint32_t get_be32(const void *ptr) # 237| { # 238|-> return be32_to_cpu(get_unaligned((const uint32_t *) ptr)); # 239| } # 240| Error: CLANG_WARNING: bluez-5.73/tools/mesh-gatt/crypto.c:32: included_from: Included from here. bluez-5.73/src/shared/util.h:248:9: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 246| static inline uint64_t get_be64(const void *ptr) # 247| { # 248|-> return be64_to_cpu(get_unaligned((const uint64_t *) ptr)); # 249| } # 250| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'vcp_get_session.part.0' bluez-5.73/src/shared/vcp.c:501:18: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 499| # 500| vcp = bt_vcp_new(db, NULL); # 501|-> vcp->att = att; # 502| # 503| bt_att_register_disconnect(att, vcp_disconnected, vcp, NULL); Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'aics_new' bluez-5.73/src/shared/vcp.c:1721:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'ip_descr' where non-null expected bluez-5.73/src/shared/vcp.c:22: included_from: Included from here. bluez-5.73/src/shared/vcp.c:1716:16: note: in expansion of macro 'new0' <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 1719| aics_gain_settng_prop = new0(struct gain_setting_prop, 1); # 1720| ip_descr = malloc(256); # 1721|-> memset(ip_descr, 0, 256); # 1722| # 1723| aics_aud_ip_st->mute = AICS_NOT_MUTED; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'vcp_audio_loc_notify' bluez-5.73/src/shared/vcp.c:1969:27: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL 'vocs_audio_loc_n' # 1967| { # 1968| uint32_t *vocs_audio_loc_n = malloc(sizeof(uint32_t)); # 1969|-> *vocs_audio_loc_n = 0; # 1970| # 1971| if (value != NULL) Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'read_vocs_audio_descriptor.part.0' bluez-5.73/src/shared/vcp.c:2131:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'vocs_ao_dec_r' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 2129| # 2130| vocs_ao_dec_r = malloc(length+1); # 2131|-> memset(vocs_ao_dec_r, 0, length+1); # 2132| memcpy(vocs_ao_dec_r, value, length); # 2133| Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'read_aics_audio_ip_description.part.0' bluez-5.73/src/shared/vcp.c:2535:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'ip_descrptn' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 2533| # 2534| ip_descrptn = malloc(length+1); # 2535|-> memset(ip_descrptn, 0, length+1); # 2536| memcpy(ip_descrptn, value, length); # 2537| Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'aics_audio_ip_desr_notify' bluez-5.73/src/shared/vcp.c:2555:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL 'aud_ip_desr' where non-null expected <built-in>: note: argument 1 of '__builtin_memset' must be non-null # 2553| # 2554| aud_ip_desr = malloc(length+1); # 2555|-> memset(aud_ip_desr, 0, length+1); # 2556| memcpy(aud_ip_desr, value, length); # 2557| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'foreach_vcs_service' bluez-5.73/src/shared/vcp.c:2691:22: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 2689| struct bt_vcs *vcs = vcp_get_vcs(vcp); # 2690| # 2691|-> vcs->service = attr; # 2692| # 2693| gatt_db_service_set_claimed(attr, true); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'foreach_vocs_service' bluez-5.73/src/shared/vcp.c:2704:23: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 2702| struct bt_vocs *vocs = vcp_get_vocs(vcp); # 2703| # 2704|-> vocs->service = attr; # 2705| # 2706| gatt_db_service_set_claimed(attr, true); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/src/shared/vcp.c: scope_hint: In function 'foreach_aics_service' bluez-5.73/src/shared/vcp.c:2717:23: warning[-Wanalyzer-null-dereference]: dereference of NULL '0' # 2715| struct bt_aics *aics = vcp_get_aics(vcp); # 2716| # 2717|-> aics->service = attr; # 2718| # 2719| gatt_db_service_set_claimed(attr, true); Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/tools/avinfo.c: scope_hint: In function ‘l2cap_connect’ bluez-5.73/tools/avinfo.c:880:13: warning[-Wanalyzer-fd-phase-mismatch]: ‘connect’ on file descriptor ‘sk’ in wrong phase # 878| l2a.l2_psm = htobs(AVDTP_PSM); # 879| # 880|-> if (connect(sk, (struct sockaddr *) &l2a, sizeof(l2a)) < 0) { # 881| printf("Connect failed. %s(%d)\n", strerror(errno), errno); # 882| close(sk); Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:225:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 223| buf[2] = 0x29; /* Unsupported configuration */ # 224| printf("Rejecting discover command\n"); # 225|-> len = write(sk, buf, 3); # 226| } else { # 227| struct seid_info *sei = (void *) (buf + 2); Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:235:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 233| sei->media_type = AVDTP_MEDIA_TYPE_AUDIO; # 234| printf("Accepting discover command\n"); # 235|-> len = write(sk, buf, 4); # 236| } # 237| break; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:244:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 242| buf[2] = 0x29; /* Unsupported configuration */ # 243| printf("Rejecting get capabilties command\n"); # 244|-> len = write(sk, buf, 3); # 245| } else if (fragment) { # 246| struct avdtp_start_header *start = (void *) buf; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:258:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 256| memcpy(&buf[3], media_transport, # 257| sizeof(media_transport)); # 258|-> len = write(sk, buf, # 259| 3 + sizeof(media_transport)); # 260| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:265:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 263| memcpy(&buf[1], media_transport, # 264| sizeof(media_transport)); # 265|-> len = write(sk, buf, # 266| 1 + sizeof(media_transport)); # 267| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:272:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 270| memcpy(&buf[1], media_transport, # 271| sizeof(media_transport)); # 272|-> len = write(sk, buf, # 273| 1 + sizeof(media_transport)); # 274| } else { Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:279:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 277| sizeof(media_transport)); # 278| printf("Accepting get capabilities command\n"); # 279|-> len = write(sk, buf, # 280| 2 + sizeof(media_transport)); # 281| } Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:291:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 289| 0x13; /* SEP In Use */ # 290| printf("Rejecting set configuration command\n"); # 291|-> len = write(sk, buf, 4); # 292| } else { # 293| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:295:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 293| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; # 294| printf("Accepting set configuration command\n"); # 295|-> len = write(sk, buf, 2); # 296| } # 297| break; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:304:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 302| buf[2] = 0x12; /* Bad ACP SEID */ # 303| printf("Rejecting get configuration command\n"); # 304|-> len = write(sk, buf, 3); # 305| } else { # 306| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:308:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 306| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; # 307| printf("Accepting get configuration command\n"); # 308|-> len = write(sk, buf, 2); # 309| } # 310| break; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:317:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 315| buf[2] = 0x31; /* Bad State */ # 316| printf("Rejecting open command\n"); # 317|-> len = write(sk, buf, 3); # 318| } else { # 319| struct sockaddr_l2 addr; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:324:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 322| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; # 323| printf("Accepting open command\n"); # 324|-> len = write(sk, buf, 2); # 325| # 326| memset(&addr, 0, sizeof(addr)); Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:346:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 344| buf[3] = 0x31; /* Bad State */ # 345| printf("Rejecting start command\n"); # 346|-> len = write(sk, buf, 4); # 347| } else { # 348| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:350:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 348| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; # 349| printf("Accepting start command\n"); # 350|-> len = write(sk, buf, 2); # 351| } # 352| break; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:359:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 357| buf[2] = 0x31; /* Bad State */ # 358| printf("Rejecting close command\n"); # 359|-> len = write(sk, buf, 3); # 360| } else { # 361| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:363:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 361| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; # 362| printf("Accepting close command\n"); # 363|-> len = write(sk, buf, 2); # 364| if (media_sock >= 0) { # 365| close(media_sock); Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:376:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 374| buf[3] = 0x31; /* Bad State */ # 375| printf("Rejecting suspend command\n"); # 376|-> len = write(sk, buf, 4); # 377| } else { # 378| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:380:5: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 378| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; # 379| printf("Accepting suspend command\n"); # 380|-> len = write(sk, buf, 2); # 381| } # 382| break; Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:387:4: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 385| hdr->message_type = AVDTP_MSG_TYPE_ACCEPT; # 386| printf("Accepting abort command\n"); # 387|-> len = write(sk, buf, 2); # 388| if (media_sock >= 0) { # 389| close(media_sock); Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:397:4: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 395| buf[1] = 0x00; # 396| printf("Unknown command\n"); # 397|-> len = write(sk, buf, 2); # 398| break; # 399| } Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/tools/avtest.c: scope_hint: In function ‘do_connect’ bluez-5.73/tools/avtest.c:532:15: warning[-Wanalyzer-fd-phase-mismatch]: ‘connect’ on file descriptor ‘sk’ in wrong phase # 530| addr.l2_psm = htobs(avctp ? 23 : 25); # 531| # 532|-> err = connect(sk, (struct sockaddr *) &addr, sizeof(addr)); # 533| if (err < 0) { # 534| perror("Unable to connect"); Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:562:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 560| hdr->packet_type = AVDTP_PKT_TYPE_SINGLE; # 561| hdr->signal_id = AVDTP_DISCOVER; # 562|-> len = write(sk, buf, 2); # 563| break; # 564| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:570:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 568| hdr->signal_id = AVDTP_GET_CAPABILITIES; # 569| buf[2] = 1 << 2; /* SEID 1 */ # 570|-> len = write(sk, buf, invalid ? 2 : 3); # 571| break; # 572| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:584:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 582| if (invalid) # 583| buf[5] = 0x01; /* LOSC != 0 */ # 584|-> len = write(sk, buf, 4 + sizeof(media_transport)); # 585| break; # 586| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:597:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 595| else # 596| buf[2] = 1 << 2; /* Valid ACP SEID */ # 597|-> len = write(sk, buf, 3); # 598| break; # 599| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:607:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 605| hdr->signal_id = AVDTP_OPEN; # 606| buf[2] = 1 << 2; /* ACP SEID */ # 607|-> len = write(sk, buf, 3); # 608| break; # 609| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:619:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 617| hdr->signal_id = AVDTP_START; # 618| buf[2] = 1 << 2; /* ACP SEID */ # 619|-> len = write(sk, buf, 3); # 620| break; # 621| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:634:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 632| else # 633| buf[2] = 1 << 2; /* Valid ACP SEID */ # 634|-> len = write(sk, buf, 3); # 635| break; # 636| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:646:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 644| hdr->signal_id = AVDTP_SUSPEND; # 645| buf[2] = 1 << 2; /* ACP SEID */ # 646|-> len = write(sk, buf, 3); # 647| break; # 648| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:655:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 653| hdr->signal_id = AVDTP_ABORT; # 654| buf[2] = 1 << 2; /* ACP SEID */ # 655|-> len = write(sk, buf, 3); # 656| break; # 657| Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:662:3: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 660| hdr->packet_type = AVDTP_PKT_TYPE_SINGLE; # 661| hdr->signal_id = cmd; # 662|-> len = write(sk, buf, 2); # 663| break; # 664| } Error: CLANG_WARNING: bluez-5.73/tools/avtest.c:698:2: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 696| memcpy(&buf[AVCTP_HEADER_LENGTH], play_pressed, sizeof(play_pressed)); # 697| # 698|-> len = write(sk, buf, AVCTP_HEADER_LENGTH + sizeof(play_pressed)); # 699| # 700| len = read(sk, buf, sizeof(buf)); Error: GCC_ANALYZER_WARNING (CWE-479): bluez-5.73/tools/bneptest.c: scope_hint: In function ‘exit_handler’ bluez-5.73/tools/bneptest.c:483:9: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘printf’ from within signal handler bluez-5.73/tools/bneptest.c:35: included_from: Included from here. bluez-5.73/src/log.h:60:9: note: in expansion of macro ‘DBG_IDX’ bluez-5.73/tools/bneptest.c:555:9: note: in expansion of macro ‘DBG’ # 481| static void exit_handler(int sig) # 482| { # 483|-> printf("got sig = %d, cleaning up...\n", sig); # 484| # 485| if (cleanup() < 0) Error: GCC_ANALYZER_WARNING (CWE-479): bluez-5.73/tools/bneptest.c:490:9: warning[-Wanalyzer-unsafe-call-within-signal-handler]: call to ‘exit’ from within signal handler bluez-5.73/src/log.h:60:9: note: in expansion of macro ‘DBG_IDX’ bluez-5.73/tools/bneptest.c:555:9: note: in expansion of macro ‘DBG’ bluez-5.73/tools/bneptest.c:490:9: note: ‘_exit’ is a possible signal-safe alternative for ‘exit’ # 488| printf("cleanup successful - exit\n"); # 489| # 490|-> exit(0); # 491| } # 492| Error: CLANG_WARNING: bluez-5.73/tools/btgatt-client.c:1824:2: warning[deadcode.DeadStores]: Value stored to 'argv' is never read # 1822| # 1823| argc -= optind; # 1824|-> argv += optind; # 1825| optind = 0; # 1826| Error: CLANG_WARNING: bluez-5.73/tools/btgatt-server.c:1212:2: warning[deadcode.DeadStores]: Value stored to 'argv' is never read # 1210| # 1211| argc -= optind; # 1212|-> argv -= optind; # 1213| optind = 0; # 1214| Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/btsnoop.c: scope_hint: In function ‘command_merge’ bluez-5.73/tools/btsnoop.c:260:1: warning[-Wanalyzer-fd-leak]: leak of file descriptor /usr/include/sys/types.h:176: included_from: Included from here. /usr/include/stdlib.h:514: included_from: Included from here. bluez-5.73/tools/btsnoop.c:21: included_from: Included from here. # 258| for (i = 0; i < num_input; i++) # 259| close(input_fd[i]); # 260|-> } # 261| # 262| static void command_extract_eir(const char *input) Error: CLANG_WARNING: bluez-5.73/tools/check-selftest.c:42:3: warning[deadcode.DeadStores]: Value stored to 'ptr' is never read # 40| char result[32], *ptr; # 41| # 42|-> ptr = fgets(result, sizeof(result), fp); # 43| fclose(fp); # 44| Error: CLANG_WARNING: bluez-5.73/tools/ciptool.c:350:7: warning[core.CallAndMessage]: 5th function call argument is an uninitialized value # 348| psm = atoi(argv[2]); # 349| # 350|-> sk = do_connect(ctl, dev_id, &src, &dst, psm, (1 << CMTP_LOOPBACK)); # 351| # 352| printf("Press CTRL-C for hangup\n"); Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/tools/cltest.c: scope_hint: In function ‘send_message’ bluez-5.73/tools/cltest.c:62:13: warning[-Wanalyzer-fd-phase-mismatch]: ‘connect’ on file descriptor ‘fd’ in wrong phase bluez-5.73/tools/cltest.c:26: included_from: Included from here. bluez-5.73/tools/cltest.c:249:33: note: in expansion of macro ‘BDADDR_ANY’ bluez-5.73/tools/cltest.c:250:53: note: in expansion of macro ‘BDADDR_ANY’ # 60| addr.l2_psm = htobs(psm); # 61| # 62|-> if (connect(fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { # 63| perror("Failed to connect transmitter socket"); # 64| close(fd); Error: CLANG_WARNING: bluez-5.73/tools/create-image.c:76:3: warning[deadcode.DeadStores]: Value stored to 'fd' is never read # 74| # 75| if (!pathname) { # 76|-> fd = -1; # 77| map = NULL; # 78| st.st_size = 0; Error: CLANG_WARNING: bluez-5.73/tools/create-image.c:84:3: warning[deadcode.DeadStores]: Value stored to 'fd' is never read # 82| fd = open(pathname, O_RDONLY | O_CLOEXEC); # 83| if (fd < 0) { # 84|-> fd = -1; # 85| map = NULL; # 86| st.st_size = 0; Error: CLANG_WARNING: bluez-5.73/tools/create-image.c:92:3: warning[deadcode.DeadStores]: Value stored to 'fd' is never read # 90| if (fstat(fd, &st) < 0) { # 91| close(fd); # 92|-> fd = -1; # 93| map = NULL; # 94| st.st_size = 0; Error: CLANG_WARNING: bluez-5.73/tools/create-image.c:105:2: warning[deadcode.DeadStores]: Value stored to 'fd' is never read # 103| # 104| close(fd); # 105|-> fd = -1; # 106| # 107| done: Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/tools/create-image.c: scope_hint: In function ‘write_block’ bluez-5.73/tools/create-image.c:108:9: warning[-Wanalyzer-possible-null-argument]: use of possibly-NULL ‘fp’ where non-null expected bluez-5.73/tools/create-image.c:16: included_from: Included from here. /usr/include/stdio.h:357:12: note: argument 1 of ‘fprintf’ must be non-null # 106| # 107| done: # 108|-> fprintf(fp, HDR_FMT, HDR_MAGIC, ino, mode, 0, 0, 1, 0, # 109| (uintmax_t) st.st_size, 0, 0, 0, 0, namelen + 1, 0, name); # 110| Error: CLANG_WARNING: bluez-5.73/tools/gatt-service.c:294:2: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 292| } # 293| # 294|-> chr_write(chr, value, len); # 295| # 296| g_dbus_pending_property_success(id); Error: CLANG_WARNING: bluez-5.73/tools/hciattach.c:816:7: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 814| # 815| /* Read reply */ # 816|-> if ((n = read_hci_event(fd, resp, 10)) < 0) { # 817| fprintf(stderr, "Failed to set baud rate on chip\n"); # 818| return -1; Error: CLANG_WARNING: bluez-5.73/tools/hciattach.c:864:7: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 862| # 863| /* Read reply */ # 864|-> if ((n = read_hci_event(fd, resp, 4)) < 0) { # 865| fprintf(stderr, "Failed to reset chip\n"); # 866| return -1; Error: CLANG_WARNING: bluez-5.73/tools/hciattach.c:886:8: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 884| # 885| /* Read reply */ # 886|-> if ((n = read_hci_event(fd, resp, 10)) < 0) { # 887| fprintf(stderr, "Failed to set BD_ADDR\n"); # 888| return -1; Error: CLANG_WARNING: bluez-5.73/tools/hciattach.c:908:7: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 906| # 907| /* Read reply */ # 908|-> if ((n = read_hci_event(fd, resp, 4)) < 0) { # 909| fprintf(stderr, "Failed to read local version\n"); # 910| return -1; Error: CLANG_WARNING: bluez-5.73/tools/hciattach.c:929:7: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 927| # 928| /* Read reply */ # 929|-> if ((n = read_hci_event(fd, resp, 4)) < 0) { # 930| fprintf(stderr, "Failed to read local supported commands\n"); # 931| return -1; Error: CLANG_WARNING: bluez-5.73/tools/hciattach.c:973:7: warning[deadcode.DeadStores]: Although the value stored to 'n' is used in the enclosing expression, the value is never actually read from 'n' # 971| } # 972| # 973|-> if ((n = read_hci_event(fd, resp, 6)) < 0) { # 974| fprintf(stderr, "Failed to set baud rate\n"); # 975| return -1; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/hciattach.c: scope_hint: In function ‘main’ bluez-5.73/tools/hciattach.c:1321:34: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘u’ # 1319| # 1320| case 2: # 1321|-> u->speed = atoi(argv[optind]); # 1322| break; # 1323| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/hciattach.c:1326:34: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘u’ # 1324| case 3: # 1325| if (!strcmp("flow", argv[optind])) # 1326|-> u->flags |= FLOW_CTL; # 1327| else # 1328| u->flags &= ~FLOW_CTL; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/hciattach.c:1328:34: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘u’ # 1326| u->flags |= FLOW_CTL; # 1327| else # 1328|-> u->flags &= ~FLOW_CTL; # 1329| break; # 1330| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/hciattach.c:1333:39: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘u’ # 1331| case 4: # 1332| if (!strcmp("sleep", argv[optind])) # 1333|-> u->pm = ENABLE_PM; # 1334| else # 1335| u->pm = DISABLE_PM; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/hciattach.c:1335:39: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘u’ # 1333| u->pm = ENABLE_PM; # 1334| else # 1335|-> u->pm = DISABLE_PM; # 1336| break; # 1337| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/hciattach.c:1339:35: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘u’ # 1337| # 1338| case 5: # 1339|-> u->bdaddr = argv[optind]; # 1340| break; # 1341| } Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/hciattach_qualcomm.c: scope_hint: In function ‘qualcomm_load_firmware’ bluez-5.73/tools/hciattach_qualcomm.c:93:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(firmware, 0)’ bluez-5.73/tools/hciattach_qualcomm.c:95:9: note: in expansion of macro ‘FAILIF’ bluez-5.73/tools/hciattach_qualcomm.c:95:9: note: in expansion of macro ‘FAILIF’ bluez-5.73/tools/hciattach_qualcomm.c:111:17: note: in expansion of macro ‘FAILIF’ # 91| int fw = open(firmware, O_RDONLY); # 92| # 93|-> fprintf(stdout, "Opening firmware file: %s\n", firmware); # 94| # 95| FAILIF(fw < 0, Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/hciattach_tialt.c: scope_hint: In function ‘texas_load_firmware’ bluez-5.73/tools/hciattach_tialt.c:95:9: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(firmware, 0)’ bluez-5.73/tools/hciattach_tialt.c:97:9: note: in expansion of macro ‘FAILIF’ bluez-5.73/tools/hciattach_tialt.c:97:9: note: in expansion of macro ‘FAILIF’ bluez-5.73/tools/hciattach_tialt.c:111:17: note: in expansion of macro ‘FAILIF’ # 93| int fw = open(firmware, O_RDONLY); # 94| # 95|-> fprintf(stdout, "Opening firmware file: %s\n", firmware); # 96| # 97| FAILIF(fw < 0, Error: GCC_ANALYZER_WARNING (CWE-401): bluez-5.73/tools/hcidump.c: scope_hint: In function ‘process_frames’ bluez-5.73/tools/hcidump.c:141:24: warning[-Wanalyzer-malloc-leak]: leak of ‘buf’ # 139| # 140| if (sock < 0) # 141|-> return -1; # 142| # 143| if (snap_len < SNAP_LEN) Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:180:9: warning[unix.Malloc]: Potential leak of memory pointed to by 'dp' # 178| for (i = 0; i < nfds; i++) { # 179| if (fds[i].revents & (POLLHUP | POLLERR | POLLNVAL)) { # 180|-> if (fds[i].fd == sock) # 181| printf("device: disconnected\n"); # 182| else Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:248:17: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 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: CLANG_WARNING: bluez-5.73/tools/hcidump.c:326:9: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 324| switch (btsnoop_type) { # 325| case 1001: # 326|-> if (be32toh(dp.flags) & 0x02) { # 327| if (be32toh(dp.flags) & 0x01) # 328| pkt_type = HCI_EVENT_PKT; Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:341:20: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 339| # 340| case 1002: # 341|-> frm.data_len = be32toh(dp.len); # 342| err = read_n(fd, frm.data, frm.data_len); # 343| break; Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:346:14: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 344| # 345| case 2001: # 346|-> opcode = be32toh(dp.flags) & 0xffff; # 347| # 348| switch (opcode) { Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:384:17: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 382| } # 383| } else { # 384|-> frm.data_len = btohs(dh.len); # 385| err = read_n(fd, frm.data, frm.data_len); # 386| } Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:394:11: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 392| # 393| frm.ptr = frm.data; # 394|-> frm.len = frm.data_len; # 395| # 396| if (parser.flags & DUMP_PKTLOG) { Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:398:9: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 396| if (parser.flags & DUMP_PKTLOG) { # 397| uint64_t ts; # 398|-> ts = be64toh(ph.ts); # 399| frm.ts.tv_sec = ts >> 32; # 400| frm.ts.tv_usec = ts & 0xffffffff; Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:403:13: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 401| } else if (parser.flags & DUMP_BTSNOOP) { # 402| uint64_t ts; # 403|-> frm.in = be32toh(dp.flags) & 0x01; # 404| ts = be64toh(dp.ts) - 0x00E03AB44A676000ll; # 405| frm.ts.tv_sec = (ts / 1000000ll) + 946684800ll; Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:408:11: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 406| frm.ts.tv_usec = ts % 1000000ll; # 407| } else { # 408|-> frm.in = dh.in; # 409| frm.ts.tv_sec = btohl(dh.ts_sec); # 410| frm.ts.tv_usec = btohl(dh.ts_usec); Error: CLANG_WARNING: bluez-5.73/tools/hcidump.c:437:7: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 435| open_flags = O_RDONLY; # 436| # 437|-> fd = open(file, open_flags, 0644); # 438| if (fd < 0) { # 439| perror("Can't open dump file"); Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/iso-tester.c: scope_hint: In function ‘create_iso_sock’ bluez-5.73/tools/iso-tester.c:1665:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘sk’ # 1663| tester_warn("Can't create socket: %s (%d)", strerror(errno), # 1664| errno); # 1665|-> return err; # 1666| } # 1667| Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/iso-tester.c: scope_hint: In function ‘listen_iso_sock’ bluez-5.73/tools/iso-tester.c:2472:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘addr’ # 2470| addr = malloc(sizeof(*addr) + sizeof(*addr->iso_bc)); # 2471| memset(addr, 0, sizeof(*addr) + sizeof(*addr->iso_bc)); # 2472|-> addr->iso_family = AF_BLUETOOTH; # 2473| bacpy(&addr->iso_bdaddr, (void *) src); # 2474| addr->iso_bdaddr_type = BDADDR_LE_PUBLIC; Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/isotest.c: scope_hint: In function ‘do_listen’ bluez-5.73/tools/isotest.c:516:26: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘addr’ bluez-5.73/tools/isotest.c:17: included_from: Included from here. # 514| addr = malloc(sizeof(*addr) + sizeof(*addr->iso_bc)); # 515| memset(addr, 0, sizeof(*addr) + sizeof(*addr->iso_bc)); # 516|-> addr->iso_family = AF_BLUETOOTH; # 517| bacpy(&addr->iso_bdaddr, mgmt_index != MGMT_INDEX_NONE ? # 518| &bdaddr : BDADDR_ANY); Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/isotest.c: scope_hint: In function ‘main’ bluez-5.73/tools/isotest.c:1208:18: warning[-Wanalyzer-possible-null-dereference]: dereference of possibly-NULL ‘iso_qos’ # 1206| iso_qos = malloc(sizeof(*iso_qos)); # 1207| /* Default to 16_2_1 */ # 1208|-> *iso_qos = presets[3].qos; # 1209| inout = true; # 1210| Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/tools/l2cap-tester.c: scope_hint: In function ‘connect_l2cap_impl’ bluez-5.73/tools/l2cap-tester.c:1373:15: warning[-Wanalyzer-fd-phase-mismatch]: ‘connect’ on file descriptor ‘sk’ in wrong phase # 1371| addr.l2_cid = htobs(cid); # 1372| # 1373|-> err = connect(sk, (struct sockaddr *) &addr, sizeof(addr)); # 1374| if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS)) { # 1375| err = -errno; Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/l2cap-tester.c: scope_hint: In function ‘l2cap_listen_cb’ bluez-5.73/tools/l2cap-tester.c:2041:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘g_io_channel_unix_get_fd(io)’ # 2039| # 2040| new_sk = accept(sk, NULL, NULL); # 2041|-> if (new_sk < 0) { # 2042| tester_warn("accept failed: %s (%u)", strerror(errno), errno); # 2043| tester_test_failed(); Error: CPPCHECK_WARNING (CWE-909): bluez-5.73/tools/mesh-cfgclient.c:2041: error[uninitStructMember]: Uninitialized struct member: result.last_seen # 2039| l_queue_length(devices) + 1); # 2040| dev = l_malloc(sizeof(struct unprov_device)); # 2041|-> *dev = result; # 2042| # 2043| } else if (dev->rssi < result.rssi) Error: CPPCHECK_WARNING (CWE-909): bluez-5.73/tools/mesh-cfgclient.c:2044: error[uninitStructMember]: Uninitialized struct member: result.last_seen # 2042| # 2043| } else if (dev->rssi < result.rssi) # 2044|-> *dev = result; # 2045| # 2046| dev->last_seen = time(NULL); Error: GCC_ANALYZER_WARNING (CWE-457): bluez-5.73/tools/mesh-gatt/crypto.c: scope_hint: In function ‘mesh_crypto_aes_ccm_encrypt’ bluez-5.73/tools/mesh-gatt/crypto.c:376:17: warning[-Wanalyzer-use-of-uninitialized-value]: use of uninitialized value ‘&mic’ # 374| # 375| if (out_msg) # 376|-> memcpy(out_msg + msg_len, mic, mic_size); # 377| # 378| if (out_mic) { Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/mesh-gatt/prov-db.c: scope_hint: In function ‘prov_file_read’ bluez-5.73/tools/mesh-gatt/prov-db.c:56:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(filename, 0)’ # 54| # 55| fd = open(filename,O_RDONLY); # 56|-> if (!fd) # 57| return NULL; # 58| Error: CLANG_WARNING: bluez-5.73/tools/meshctl.c:326:19: warning[core.NullDereference]: Access to field 'mesh_devices' results in a dereference of a null pointer (loaded from variable 'default_ctrl') # 324| static void forget_mesh_devices() # 325| { # 326|-> g_list_free_full(default_ctrl->mesh_devices, g_free); # 327| default_ctrl->mesh_devices = NULL; # 328| } Error: CPPCHECK_WARNING (CWE-457): bluez-5.73/tools/meshctl.c:762: warning[uninitvar]: Uninitialized variable: addr # 760| dbus_message_iter_get_basic(&iter, &addr); # 761| # 762|-> bt_shell_printf("Attempting to disconnect from %s\n", addr); # 763| } # 764| Error: CLANG_WARNING: bluez-5.73/tools/meshctl.c:762:2: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 760| dbus_message_iter_get_basic(&iter, &addr); # 761| # 762|-> bt_shell_printf("Attempting to disconnect from %s\n", addr); # 763| } # 764| Error: CLANG_WARNING: bluez-5.73/tools/meshctl.c:1957:2: warning[deadcode.DeadStores]: Value stored to 'len' is never read # 1955| sprintf(mesh_local_config_filename + len + extra, "%s", # 1956| "local_node.json"); # 1957|-> len = len + extra + strlen("local_node.json"); # 1958| # 1959| if (!prov_db_read_local_node(mesh_local_config_filename, true)) { Error: GCC_ANALYZER_WARNING (CWE-476): /usr/include/glib-2.0/glib/gstring.h:37: included_from: Included from here. /usr/include/glib-2.0/glib/giochannel.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:56: included_from: Included from here. bluez-5.73/tools/mpris-proxy.c:26: included_from: Included from here. bluez-5.73/tools/mpris-proxy.c: scope_hint: In function ‘mpris_busname’ bluez-5.73/tools/mpris-proxy.c:1863:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘name’ /usr/include/glib-2.0/glib/gstrfuncs.h:71:29: note: in definition of macro ‘g_ascii_isdigit’ bluez-5.73/tools/mpris-proxy.c:1967:27: note: in expansion of macro ‘g_strdup’ bluez-5.73/tools/mpris-proxy.c:1967:27: note: in expansion of macro ‘g_strdup’ /usr/include/glib-2.0/glib/glist.h:34: included_from: Included from here. /usr/include/glib-2.0/glib/ghash.h:36: included_from: Included from here. /usr/include/glib-2.0/glib.h:52: included_from: Included from here. bluez-5.73/tools/mpris-proxy.c: scope_hint: In function ‘mpris_busname’ /usr/include/glib-2.0/glib/gmem.h:332:57: note: in expansion of macro ‘_G_NEW’ bluez-5.73/tools/mpris-proxy.c:1969:18: note: in expansion of macro ‘g_new0’ /usr/include/glib-2.0/glib/gstrfuncs.h:71:29: note: in definition of macro ‘g_ascii_isdigit’ # 1861| static char *mpris_busname(char *name) # 1862| { # 1863|-> if (g_ascii_isdigit(name[0])) # 1864| return g_strconcat(MPRIS_BUS_NAME, "bt_", # 1865| g_strcanon(name, A_Z a_z _0_9, '_'), NULL); Error: CLANG_WARNING: bluez-5.73/tools/obex-server-tool.c:133:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 131| data = g_new0(struct transfer_data, 1); # 132| # 133|-> data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600); # 134| if (data->fd < 0) { # 135| g_printerr("open(%s): %s\n", name, strerror(errno)); Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/tools/obex-server-tool.c: scope_hint: In function ‘handle_put’ bluez-5.73/tools/obex-server-tool.c:133:20: warning[-Wanalyzer-null-argument]: use of NULL ‘name’ where non-null expected bluez-5.73/tools/obex-server-tool.c:17: included_from: Included from here. /usr/include/fcntl.h:209:12: note: argument 1 of ‘open’ must be non-null # 131| data = g_new0(struct transfer_data, 1); # 132| # 133|-> data->fd = open(name, O_WRONLY | O_CREAT | O_NOCTTY, 0600); # 134| if (data->fd < 0) { # 135| g_printerr("open(%s): %s\n", name, strerror(errno)); Error: CLANG_WARNING: bluez-5.73/tools/obex-server-tool.c:192:13: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 190| data = g_new0(struct transfer_data, 1); # 191| # 192|-> data->fd = open(name, O_RDONLY | O_NOCTTY, 0); # 193| if (data->fd < 0) { # 194| g_printerr("open(%s): %s\n", name, strerror(errno)); Error: GCC_ANALYZER_WARNING (CWE-688): bluez-5.73/tools/obex-server-tool.c: scope_hint: In function ‘handle_get’ bluez-5.73/tools/obex-server-tool.c:192:20: warning[-Wanalyzer-null-argument]: use of NULL ‘name’ where non-null expected /usr/include/fcntl.h:209:12: note: argument 1 of ‘open’ must be non-null # 190| data = g_new0(struct transfer_data, 1); # 191| # 192|-> data->fd = open(name, O_RDONLY | O_NOCTTY, 0); # 193| if (data->fd < 0) { # 194| g_printerr("open(%s): %s\n", name, strerror(errno)); Error: CLANG_WARNING: bluez-5.73/tools/parser/amp.c:15: included_from: Included from here. bluez-5.73/tools/parser/parser.h:121:16: warning[core.NullDereference]: Dereference of null pointer # 119| if (parser.flags & DUMP_VERBOSE) { # 120| struct tm tm; # 121|-> time_t t = f->ts.tv_sec; # 122| localtime_r(&t, &tm); # 123| printf("%04d-%02d-%02d %02d:%02d:%02d.%06lu ", Error: CLANG_WARNING: bluez-5.73/tools/parser/parser.h:127:27: warning[core.NullDereference]: Dereference of null pointer # 125| tm.tm_hour, tm.tm_min, tm.tm_sec, f->ts.tv_usec); # 126| } else # 127|-> printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec); # 128| } # 129| printf("%c ", (f->in ? '>' : '<')); Error: CLANG_WARNING: bluez-5.73/tools/parser/parser.h:129:18: warning[core.NullDereference]: Access to field 'in' results in a dereference of a null pointer (loaded from variable 'f') # 127| printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec); # 128| } # 129|-> printf("%c ", (f->in ? '>' : '<')); # 130| parser.state = 1; # 131| } else Error: GCC_ANALYZER_WARNING (CWE-476): bluez-5.73/tools/parser/amp.c:15: included_from: Included from here. bluez-5.73/tools/parser/parser.h: scope_hint: In function ‘p_indent’ bluez-5.73/tools/parser/parser.h:129:33: warning[-Wanalyzer-null-dereference]: dereference of NULL ‘f’ # 127| printf("%8lu.%06lu ", f->ts.tv_sec, f->ts.tv_usec); # 128| } # 129|-> printf("%c ", (f->in ? '>' : '<')); # 130| parser.state = 1; # 131| } else Error: CLANG_WARNING: bluez-5.73/tools/parser/ppp.c:22: included_from: Included from here. bluez-5.73/tools/parser/parser.h:156:2: warning[core.uninitialized.UndefReturn]: Undefined or garbage value returned to caller # 154| frm->ptr += 1; # 155| frm->len -= 1; # 156|-> return *u8_ptr; # 157| } # 158| Error: CLANG_WARNING: bluez-5.73/tools/parser/ppp.c:108:30: warning[core.UndefinedBinaryOperatorResult]: The left operand of '&' is a garbage value # 106| dir2str(frm->in), addr, ctrl, frm->len, fcs); # 107| # 108|-> if (*((uint8_t *) frm->ptr) & 0x80) # 109| proto = p_get_u16(frm); # 110| else Error: GCC_ANALYZER_WARNING (CWE-1341): bluez-5.73/tools/rctest.c: scope_hint: In function ‘do_listen’ bluez-5.73/tools/rctest.c:436:9: warning[-Wanalyzer-fd-double-close]: double ‘close’ of file descriptor ‘sk’ bluez-5.73/tools/rctest.c:18: included_from: Included from here. # 434| # 435| error: # 436|-> close(sk); # 437| exit(1); # 438| } Error: GCC_ANALYZER_WARNING: bluez-5.73/tools/rfcomm-tester.c: scope_hint: In function ‘create_rfcomm_sock’ bluez-5.73/tools/rfcomm-tester.c:404:13: warning[-Wanalyzer-fd-use-without-check]: ‘bind’ on possibly invalid file descriptor ‘sk’ # 402| bacpy(&addr.rc_bdaddr, address); # 403| # 404|-> if (bind(sk, (struct sockaddr *) &addr, sizeof(addr)) < 0) { # 405| close(sk); # 406| return -1; Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/tools/rfcomm-tester.c: scope_hint: In function ‘connect_rfcomm_sock’ bluez-5.73/tools/rfcomm-tester.c:422:15: warning[-Wanalyzer-fd-phase-mismatch]: ‘connect’ on file descriptor ‘sk’ in wrong phase # 420| addr.rc_channel = htobs(channel); # 421| # 422|-> err = connect(sk, (struct sockaddr *) &addr, sizeof(addr)); # 423| if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS)) # 424| return err; Error: GCC_ANALYZER_WARNING: bluez-5.73/tools/rfcomm-tester.c:422:15: warning[-Wanalyzer-fd-use-without-check]: ‘connect’ on possibly invalid file descriptor ‘sk’ # 420| addr.rc_channel = htobs(channel); # 421| # 422|-> err = connect(sk, (struct sockaddr *) &addr, sizeof(addr)); # 423| if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS)) # 424| return err; Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/rfcomm-tester.c: scope_hint: In function ‘rfcomm_listen_cb’ bluez-5.73/tools/rfcomm-tester.c:707:12: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘g_io_channel_unix_get_fd(io)’ # 705| # 706| new_sk = accept(sk, NULL, NULL); # 707|-> if (new_sk < 0) { # 708| tester_test_failed(); # 709| return false; Error: CLANG_WARNING: bluez-5.73/tools/rfcomm.c:234:3: warning[deadcode.DeadStores]: Value stored to 'i' is never read # 232| sigaction(SIGPIPE, &sa, NULL); # 233| # 234|-> i = execvp(cmdargv[0], cmdargv); # 235| fprintf(stderr, "Couldn't execute command %s (errno=%d:%s)\n", # 236| cmdargv[0], errno, strerror(errno)); Error: CLANG_WARNING: bluez-5.73/tools/rfcomm.c:234:7: warning[core.NonNullParamChecker]: Null pointer passed to 1st parameter expecting 'nonnull' # 232| sigaction(SIGPIPE, &sa, NULL); # 233| # 234|-> i = execvp(cmdargv[0], cmdargv); # 235| fprintf(stderr, "Couldn't execute command %s (errno=%d:%s)\n", # 236| cmdargv[0], errno, strerror(errno)); Error: CLANG_WARNING: bluez-5.73/tools/rfcomm.c:354:8: warning[deadcode.DeadStores]: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' # 352| # 353| snprintf(devname, MAXPATHLEN - 1, "/dev/bluetooth/rfcomm/%d", dev); # 354|-> if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { # 355| if (try--) { # 356| snprintf(devname, MAXPATHLEN - 1, "/dev/rfcomm%d", dev); Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/rfcomm.c: scope_hint: In function ‘cmd_connect’ bluez-5.73/tools/rfcomm.c:354:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&devname, 256)’ bluez-5.73/tools/rfcomm.c:17: included_from: Included from here. # 352| # 353| snprintf(devname, MAXPATHLEN - 1, "/dev/bluetooth/rfcomm/%d", dev); # 354|-> if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { # 355| if (try--) { # 356| snprintf(devname, MAXPATHLEN - 1, "/dev/rfcomm%d", dev); Error: CLANG_WARNING: bluez-5.73/tools/rfcomm.c:497:14: warning[core.uninitialized.Assign]: Assigned value is garbage or undefined # 495| bacpy(&req.src, &laddr.rc_bdaddr); # 496| bacpy(&req.dst, &raddr.rc_bdaddr); # 497|-> req.channel = raddr.rc_channel; # 498| # 499| dev = ioctl(nsk, RFCOMMCREATEDEV, &req); Error: CLANG_WARNING: bluez-5.73/tools/rfcomm.c:515:8: warning[deadcode.DeadStores]: Although the value stored to 'fd' is used in the enclosing expression, the value is never actually read from 'fd' # 513| # 514| snprintf(devname, MAXPATHLEN - 1, "/dev/bluetooth/rfcomm/%d", dev); # 515|-> if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { # 516| if (try--) { # 517| snprintf(devname, MAXPATHLEN - 1, "/dev/rfcomm%d", dev); Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/rfcomm.c: scope_hint: In function ‘cmd_listen’ bluez-5.73/tools/rfcomm.c:515:20: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘open(&devname, 256)’ # 513| # 514| snprintf(devname, MAXPATHLEN - 1, "/dev/bluetooth/rfcomm/%d", dev); # 515|-> if ((fd = open(devname, O_RDONLY | O_NOCTTY)) < 0) { # 516| if (try--) { # 517| snprintf(devname, MAXPATHLEN - 1, "/dev/rfcomm%d", dev); Error: GCC_ANALYZER_WARNING (CWE-775): bluez-5.73/tools/sco-tester.c: scope_hint: In function ‘create_sco_sock’ bluez-5.73/tools/sco-tester.c:547:24: warning[-Wanalyzer-fd-leak]: leak of file descriptor ‘sk’ # 545| tester_warn("Can't create socket: %s (%d)", strerror(errno), # 546| errno); # 547|-> return err; # 548| } # 549| Error: GCC_ANALYZER_WARNING (CWE-666): bluez-5.73/tools/sco-tester.c: scope_hint: In function ‘connect_sco_sock’ bluez-5.73/tools/sco-tester.c:587:15: warning[-Wanalyzer-fd-phase-mismatch]: ‘connect’ on file descriptor ‘sk’ in wrong phase # 585| bacpy(&addr.sco_bdaddr, (void *) client_bdaddr); # 586| # 587|-> err = connect(sk, (struct sockaddr *) &addr, sizeof(addr)); # 588| if (err < 0 && !(errno == EAGAIN || errno == EINPROGRESS)) { # 589| err = -errno; Error: CLANG_WARNING: bluez-5.73/tools/sdptool.c:941:26: warning[unix.MallocSizeof]: Result of 'malloc' is converted to a pointer of type 'uint32_t', which is incompatible with sizeof operand type 'int' # 939| } else if (!strncasecmp(argv[i], "0x", 2)) { # 940| /* Int */ # 941|-> uint32_t *value_int = malloc(sizeof(int)); # 942| if (!value_int) { # 943| ret = -ENOMEM; Error: CLANG_WARNING: bluez-5.73/tools/sdptool.c:980:4: warning[core.CallAndMessage]: 1st function call argument is an uninitialized value # 978| for (i = 0; i < argc; i++) # 979| if (allocArray) # 980|-> free(allocArray[i]); # 981| # 982| free(dtdArray); Error: CLANG_WARNING: bluez-5.73/tools/sdptool.c:3777:2: warning[unix.Malloc]: Potential leak of memory pointed to by 'si.name' # 3775| si.name = strdup(argv[0]); # 3776| # 3777|-> return add_service(0, &si); # 3778| } # 3779| Error: CLANG_WARNING: bluez-5.73/tools/sdptool.c:4112:4: warning[unix.Malloc]: Potential leak of memory pointed to by 'context.svc' # 4110| if (!class && !uuid) { # 4111| printf("Unknown service %s\n", context.svc); # 4112|-> return -1; # 4113| } # 4114| } Error: CPPCHECK_WARNING (CWE-457): bluez-5.73/tools/test-runner.c:945: warning[uninitvar]: Uninitialized variable: argv # 943| envp[pos] = NULL; # 944| # 945|-> printf("Running command %s\n", cmdname ? cmdname : argv[0]); # 946| # 947| pid = fork(); Error: CLANG_WARNING: bluez-5.73/tools/test-runner.c:945:2: warning[core.CallAndMessage]: 2nd function call argument is an uninitialized value # 943| envp[pos] = NULL; # 944| # 945|-> printf("Running command %s\n", cmdname ? cmdname : argv[0]); # 946| # 947| pid = fork();