From 0cac149a4bdfd96350e34bb8bcd9baff6df9f143 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 7 Aug 2025 17:50:31 +0200 Subject: [PATCH] =?UTF-8?q?mesh:=20Fix=20'buf=E2=80=99=20may=20be=20used?= =?UTF-8?q?=20uninitialized=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ../dist-unpack/bluez-5.83/tools/mesh/agent.c: In function ‘response_decimal’: ../dist-unpack/bluez-5.83/tools/mesh/agent.c:94:9: warning: ‘buf’ may be used uninitialized [-Wmaybe-uninitialized] 94 | bt_put_be32(atoi(input), buf); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../dist-unpack/bluez-5.83/tools/mesh/agent.c:20: ../dist-unpack/bluez-5.83/lib/bluetooth/bluetooth.h:342:20: note: by argument 2 of type ‘const void *’ to ‘bt_put_be32’ declared here 342 | static inline void bt_put_be32(uint32_t val, const void *ptr) | ^~~~~~~~~~~ ../dist-unpack/bluez-5.83/tools/mesh/agent.c:88:17: note: ‘buf’ declared here 88 | uint8_t buf[DECIMAL_OOB_LEN]; | ^~~ --- tools/mesh/agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mesh/agent.c b/tools/mesh/agent.c index 7a62f345d..4a2c6a0d8 100644 --- a/tools/mesh/agent.c +++ b/tools/mesh/agent.c @@ -85,7 +85,7 @@ static void response_hexadecimal(const char *input, void *user_data) static void response_decimal(const char *input, void *user_data) { - uint8_t buf[DECIMAL_OOB_LEN]; + uint8_t buf[DECIMAL_OOB_LEN] = {0}; uint16_t len = DECIMAL_OOB_LEN; if (strlen(input) > pending_request.len) -- 2.47.3