From 15ea63b1ee6cd895c48cd36aa39f1a11bffc9573 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 24 Oct 2023 12:50:04 +0100 Subject: [PATCH] Fix malloc(0) in BLE Spam --- applications/external/ble_spam/protocols/easysetup.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/applications/external/ble_spam/protocols/easysetup.c b/applications/external/ble_spam/protocols/easysetup.c index b95cab031..4dad1e67b 100644 --- a/applications/external/ble_spam/protocols/easysetup.c +++ b/applications/external/ble_spam/protocols/easysetup.c @@ -84,7 +84,11 @@ void easysetup_make_packet(uint8_t* out_size, uint8_t** out_packet, const Protoc if(cfg && cfg->type != 0x00) { type = cfg->type; } else { - type = rand() % EasysetupTypeCOUNT; + const EasysetupType types[] = { + EasysetupTypeBuds, + EasysetupTypeWatch, + }; + type = types[rand() % COUNT_OF(types)]; } uint8_t size = packet_sizes[type];