tests/fuzz: guard SCCalloc result in fuzz_decodebase64

If SCCalloc fails, decoded is NULL and the subsequent SCBase64Decode
call would dereference it. Return early on allocation failure.
pull/15601/head
Denis Balashov 1 month ago committed by Victor Julien
parent 2c16fb716b
commit 7124fdebf1

@ -19,6 +19,8 @@ static void Base64FuzzTest(const uint8_t *src, size_t len)
{
uint32_t decoded_len = SCBase64DecodeBufferSize((uint32_t)len);
uint8_t *decoded = SCCalloc(decoded_len, sizeof(uint8_t));
if (decoded == NULL)
return;
for (uint8_t mode = SCBase64ModeRFC2045; mode <= SCBase64ModeStrict; mode++) {
(void)SCBase64Decode(src, len, mode, decoded);

Loading…
Cancel
Save