1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

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.
This commit is contained in:
Joseph Bisch 2017-11-02 11:48:30 -04:00
parent f9d69597ef
commit f4b89044f0

View File

@ -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';