diff options
author | Joseph Bisch <joseph.bisch@gmail.com> | 2017-11-02 11:48:30 -0400 |
---|---|---|
committer | Joseph Bisch <joseph.bisch@gmail.com> | 2017-11-02 11:48:30 -0400 |
commit | f4b89044f075038d29089435f7620a068507d80e (patch) | |
tree | f626e49a0ac4fa067580b7b8a8af0e5db8eeae55 /src/fe-fuzz/irc | |
parent | f9d69597ef1e204640d5ce104061717aca0d213a (diff) | |
download | irssi-f4b89044f075038d29089435f7620a068507d80e.zip |
Fix malloc parameter in fe-fuzz
It is fairly safe to assume that sizeof(char) will always be 1 anyway
and replace the size calculation with a comment explaining the
calculation.
Diffstat (limited to 'src/fe-fuzz/irc')
-rw-r--r-- | src/fe-fuzz/irc/core/event-get-params.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fe-fuzz/irc/core/event-get-params.c b/src/fe-fuzz/irc/core/event-get-params.c index fc21bbeb..f8060ffe 100644 --- a/src/fe-fuzz/irc/core/event-get-params.c +++ b/src/fe-fuzz/irc/core/event-get-params.c @@ -52,7 +52,8 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { return 0; } uint8_t count = *data; - char *copy = malloc(sizeof(char)*(size-1+1)); + /* malloc(size) instead of size+1, because we already used one byte of data */ + char *copy = malloc(size); memcpy(copy, data+1, size-1); copy[size-1] = '\0'; |