From ecf68cf70b9eeadd075c06eebc29979fb0586130 Mon Sep 17 00:00:00 2001 From: Max Moroz Date: Fri, 31 May 2019 20:47:11 -0700 Subject: [PATCH] [njs] Null terminate the script string. --- projects/njs/njs_process_script_fuzzer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/njs/njs_process_script_fuzzer.c b/projects/njs/njs_process_script_fuzzer.c index b90425d9f..1a1ac0f7d 100644 --- a/projects/njs/njs_process_script_fuzzer.c +++ b/projects/njs/njs_process_script_fuzzer.c @@ -674,8 +674,9 @@ lvlhsh_pool_free(void *pool, void *p, size_t size) int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if (size == 0) return 0; - char* input = malloc(size); + char* input = malloc(size + 1); memcpy(input, data, size); + input[size] = 0; nxt_str_t line = {size, input}; njs_vm_t *vm;