mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 16:42:30 +02:00
Use gchar and g_strndup in fe-fuzz
This commit is contained in:
parent
f4b89044f0
commit
532527ffa6
1 changed files with 2 additions and 4 deletions
|
|
@ -53,9 +53,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
}
|
}
|
||||||
uint8_t count = *data;
|
uint8_t count = *data;
|
||||||
/* malloc(size) instead of size+1, because we already used one byte of data */
|
/* malloc(size) instead of size+1, because we already used one byte of data */
|
||||||
char *copy = malloc(size);
|
gchar *copy = g_strndup((const gchar *)data+1, size-1);
|
||||||
memcpy(copy, data+1, size-1);
|
|
||||||
copy[size-1] = '\0';
|
|
||||||
|
|
||||||
char *output0;
|
char *output0;
|
||||||
char *output1;
|
char *output1;
|
||||||
|
|
@ -82,6 +80,6 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||||
params = event_get_params(copy, 4, &output0, &output1, &output2, &output3);
|
params = event_get_params(copy, 4, &output0, &output1, &output2, &output3);
|
||||||
}
|
}
|
||||||
g_free(params);
|
g_free(params);
|
||||||
free(copy);
|
g_free(copy);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue