From 72a6991b80c6e6c47a3b84337f62f0a02bd30391 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Tue, 27 Jan 2026 13:40:38 -0500 Subject: [PATCH] bluetooth: Don't use a non-string to initialize NG_HCI_BDADDR_ANY Explicitly use an array of 6 zeroes instead of a C string containing nul characters. GCC 15 warns about the truncation, but this is cleaner regardless. In file included from /usr/obj/.../amd64.amd64/tmp/usr/include/bluetooth.h:51, from usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c:45: usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c: In function 'register_sdp': usr.sbin/virtual_oss/virtual_bt_speaker/bt_speaker.c:96:13: error: initializer-string for array of 'unsigned char' truncates NUL terminator but destination lacks 'nonstring' attribute (7 chars into 6 available) [-Werror=unterminated-string-initialization] 96 | NG_HCI_BDADDR_ANY, (const uint8_t *)&record, sizeof(record), | ^~~~~~~~~~~~~~~~~ Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D54869 --- sys/netgraph/bluetooth/include/ng_hci.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netgraph/bluetooth/include/ng_hci.h b/sys/netgraph/bluetooth/include/ng_hci.h index 54980e128bb..bbe9541c25c 100644 --- a/sys/netgraph/bluetooth/include/ng_hci.h +++ b/sys/netgraph/bluetooth/include/ng_hci.h @@ -447,8 +447,8 @@ typedef struct { } __attribute__ ((packed)) bdaddr_t; typedef bdaddr_t * bdaddr_p; -/* Any BD_ADDR. Note: This is actually 7 bytes (count '\0' terminator) */ -#define NG_HCI_BDADDR_ANY (&(const bdaddr_t){"\000\000\000\000\000\000"}) +/* Any BD_ADDR. */ +#define NG_HCI_BDADDR_ANY (&(const bdaddr_t){ { 0, 0, 0, 0, 0, 0 } }) /* HCI status return parameter */ typedef struct {