Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tests/fuzzers/ucl_add_string_fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
// We dont null-terminate the string and by the design
// of the API passing 0 as size with non null-terminated string
// gives undefined behavior.
if(size==0){
return 0;
}
if(size == 0 || data[size-1] != '\0') {
char *new_data = (char *)malloc(size + 1);
memcpy(new_data, data, size);
new_data[size] = '\0';
data = (const uint8_t *)new_data;
size++;
}
struct ucl_parser *parser;
parser = ucl_parser_new(0);

Expand Down