datasets: fix new -Wshorten-64-to-32 warning

Ticket: #6186
pull/13179/head
Philippe Antoine 1 year ago committed by Victor Julien
parent 8545ef2e56
commit 527b05b6b8

@ -1370,7 +1370,11 @@ static int DatasetOpSerialized(Dataset *set, const char *string, DatasetOpFunc D
switch (set->type) {
case DATASET_TYPE_STRING: {
uint32_t decoded_size = SCBase64DecodeBufferSize(strlen(string));
if (strlen(string) > UINT16_MAX) {
// size check before cast and stack allocation
return -1;
}
uint32_t decoded_size = SCBase64DecodeBufferSize((uint32_t)strlen(string));
uint8_t decoded[decoded_size];
uint32_t num_decoded = SCBase64Decode(
(const uint8_t *)string, strlen(string), SCBase64ModeStrict, decoded);

Loading…
Cancel
Save