Tiny formatting changes + suppress implicit memcpy warning

This commit is contained in:
michael-grunder 2020-12-12 11:56:35 -08:00
parent f746a28e71
commit 297ecbecb7
1 changed files with 17 additions and 18 deletions

View File

@ -32,27 +32,26 @@
*/ */
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "hiredis.h" #include "hiredis.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
char *new_str, *cmd;
if(size<3) if (size < 3)
return 0; return 0;
char *new_str = malloc(size+1); new_str = malloc(size+1);
if (new_str == NULL) if (new_str == NULL)
return 0; return 0;
char *cmd; memcpy(new_str, data, size);
int len; new_str[size] = '\0';
memcpy(new_str, data, size); redisFormatCommand(&cmd, new_str);
new_str[size] = '\0';
len = redisFormatCommand(&cmd, new_str); if (cmd != NULL)
hi_free(cmd);
if(cmd!=NULL) free(new_str);
hi_free(cmd); return 0;
free(new_str);
return 0;
} }