Fix malloc(0) in BLE Spam

This commit is contained in:
Willy-JL
2023-10-24 12:50:04 +01:00
parent c5d44fed34
commit 15ea63b1ee

View File

@@ -84,7 +84,11 @@ void easysetup_make_packet(uint8_t* out_size, uint8_t** out_packet, const Protoc
if(cfg && cfg->type != 0x00) { if(cfg && cfg->type != 0x00) {
type = cfg->type; type = cfg->type;
} else { } else {
type = rand() % EasysetupTypeCOUNT; const EasysetupType types[] = {
EasysetupTypeBuds,
EasysetupTypeWatch,
};
type = types[rand() % COUNT_OF(types)];
} }
uint8_t size = packet_sizes[type]; uint8_t size = packet_sizes[type];