Browse Source

test.c: Fix buffer overrun found by coverity

Max Bruckner 8 years ago
parent
commit
c866abd842
1 changed files with 1 additions and 1 deletions
  1. 1 1
      test.c

+ 1 - 1
test.c

@@ -114,7 +114,7 @@ static int print_preallocated(cJSON *root)
     }
     }
 
 
     /* create buffer to fail */
     /* create buffer to fail */
-    len_fail = strlen(out);
+    len_fail = strlen(out) + sizeof('\0');
     buf_fail = (char*)malloc(len_fail);
     buf_fail = (char*)malloc(len_fail);
     if (buf_fail == NULL)
     if (buf_fail == NULL)
     {
     {