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:
parent
f9d69597ef
commit
f4b89044f0
@ -52,7 +52,8 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
uint8_t count = *data;
|
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);
|
memcpy(copy, data+1, size-1);
|
||||||
copy[size-1] = '\0';
|
copy[size-1] = '\0';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user