From 9e65b9472f9706116698be000002978b33654c45 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Thu, 27 Feb 2025 23:20:03 +0000 Subject: [PATCH] Fix BLE_ID/BT_ID commands --- applications/main/bad_kb/helpers/ducky_script.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/applications/main/bad_kb/helpers/ducky_script.c b/applications/main/bad_kb/helpers/ducky_script.c index e226093b7..7e2af578a 100644 --- a/applications/main/bad_kb/helpers/ducky_script.c +++ b/applications/main/bad_kb/helpers/ducky_script.c @@ -259,9 +259,12 @@ static bool ducky_set_ble_id(BadKbScript* bad_kb, const char* line) { for(size_t i = 0; i < sizeof(ble_hid_cfg->mac); i++) { const char* hex_byte = &line[i * 3]; - if(sscanf(hex_byte, "%02hhX", &ble_hid_cfg->mac[sizeof(ble_hid_cfg->mac) - 1 - i]) != 1) { + // This sscanf() doesn't work well with %02hhX, need to use a u32 + uint32_t temp_uint; + if(sscanf(hex_byte, "%02lX", &temp_uint) != 1) { return false; } + ble_hid_cfg->mac[sizeof(ble_hid_cfg->mac) - 1 - i] = temp_uint; } strlcpy(ble_hid_cfg->name, line + mac_len, sizeof(ble_hid_cfg->name));