diff options
Diffstat (limited to 'fuzzing/format_command_fuzzer.c')
| -rw-r--r-- | fuzzing/format_command_fuzzer.c | 35 | 
1 files changed, 17 insertions, 18 deletions
| diff --git a/fuzzing/format_command_fuzzer.c b/fuzzing/format_command_fuzzer.c index e5633b4..91adeac 100644 --- a/fuzzing/format_command_fuzzer.c +++ b/fuzzing/format_command_fuzzer.c @@ -32,27 +32,26 @@   */  #include <stdlib.h> +#include <string.h>  #include "hiredis.h"  int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { -	 -	if(size<3) -		return 0; -	 -	char *new_str = malloc(size+1); -	if (new_str == NULL) -		return 0; +    char *new_str, *cmd; -	char *cmd; -	int len; -	 -	memcpy(new_str, data, size); -	new_str[size] = '\0'; +    if (size < 3) +        return 0; -	len = redisFormatCommand(&cmd, new_str); -	 -	if(cmd!=NULL) -		hi_free(cmd); -	free(new_str); -	return 0; +    new_str = malloc(size+1); +    if (new_str == NULL) +        return 0; + +    memcpy(new_str, data, size); +    new_str[size] = '\0'; + +    redisFormatCommand(&cmd, new_str); + +    if (cmd != NULL) +        hi_free(cmd); +    free(new_str); +    return 0;  } | 
