Fix memory allocation check in aflpp custom mutators

The memory allocation check in afl_custom_fuzz function was incorrect.
The condition was erroneously checking if ptr was non-null, whereas it
should return 0 when ptr is null. Correct the condition to properly
handle memory allocation failures.

Fixes: 32ffa266 ("max_len support")
This commit is contained in:
Kuan-Wei Chiu 2024-06-13 00:39:20 +08:00
parent 0c9b460cc4
commit d45cd63583
2 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ size_t afl_custom_fuzz(my_mutator_t *data, uint8_t *buf, size_t buf_size,
u8 *ptr = realloc(data->buf, max_size); u8 *ptr = realloc(data->buf, max_size);
if (ptr) { if (!ptr) {
return 0; return 0;

View File

@ -53,7 +53,7 @@ size_t afl_custom_fuzz(my_mutator_t *data, uint8_t *buf, size_t buf_size,
u8 *ptr = realloc(data->buf, max_size); u8 *ptr = realloc(data->buf, max_size);
if (ptr) { if (!ptr) {
return 0; return 0;