From 75eda690c4af2bf67b026696f504a11d71582884 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Thu, 16 May 2024 11:03:07 +0200 Subject: [PATCH] shared/gatt-client: Fix uninitialised variable usage Error: UNINIT (CWE-457): [#def44] [important] src/shared/gatt-client.c:1669:2: var_decl: Declaring variable "value" without initializer. src/shared/gatt-client.c:1686:2: uninit_use_in_call: Using uninitialized value "value" when calling "bt_gatt_client_write_value". 1684| } 1685| 1686|-> att_id = bt_gatt_client_write_value(notify_data->client, 1687| notify_data->chrc->ccc_handle, 1688| (void *)&value, sizeof(value), --- src/shared/gatt-client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/gatt-client.c b/src/shared/gatt-client.c index dcf6f0211..8e4ae7e5e 100644 --- a/src/shared/gatt-client.c +++ b/src/shared/gatt-client.c @@ -1666,7 +1666,7 @@ static bool notify_data_write_ccc(struct notify_data *notify_data, bool enable, bt_gatt_client_callback_t callback) { unsigned int att_id; - uint16_t value; + uint16_t value = 0x0000; uint16_t properties = notify_data->chrc->properties; assert(notify_data->chrc->ccc_handle); -- 2.47.3