summaryrefslogtreecommitdiff
path: root/fuzzing
diff options
context:
space:
mode:
authormichael-grunder <michael.grunder@gmail.com>2020-12-12 11:56:35 -0800
committermichael-grunder <michael.grunder@gmail.com>2020-12-12 11:56:35 -0800
commit297ecbecb71616977ab0bb9b7387d8fa19a5a54f (patch)
treefdd371dd2f52151e14fd66fcd6c2eaa70125bb0b /fuzzing
parentf746a28e71c14ce0adca17e4998514e5d19c317e (diff)
Tiny formatting changes + suppress implicit memcpy warning
Diffstat (limited to 'fuzzing')
-rw-r--r--fuzzing/format_command_fuzzer.c35
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;
}