summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Bisch <joseph.bisch@gmail.com>2017-11-02 11:56:53 -0400
committerJoseph Bisch <joseph.bisch@gmail.com>2017-11-02 11:56:53 -0400
commit532527ffa6a5eaccdbf607a2dc3d0e6ef884fce9 (patch)
tree7fc4cbf19ecf61bda2a7a1cac5d26f12f8445dcc /src
parentf4b89044f075038d29089435f7620a068507d80e (diff)
downloadirssi-532527ffa6a5eaccdbf607a2dc3d0e6ef884fce9.zip
Use gchar and g_strndup in fe-fuzz
Diffstat (limited to 'src')
-rw-r--r--src/fe-fuzz/irc/core/event-get-params.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/fe-fuzz/irc/core/event-get-params.c b/src/fe-fuzz/irc/core/event-get-params.c
index f8060ffe..6266ffb6 100644
--- a/src/fe-fuzz/irc/core/event-get-params.c
+++ b/src/fe-fuzz/irc/core/event-get-params.c
@@ -53,9 +53,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
}
uint8_t count = *data;
/* 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';
+ gchar *copy = g_strndup((const gchar *)data+1, size-1);
char *output0;
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);
}
g_free(params);
- free(copy);
+ g_free(copy);
return 0;
}