shithub: fuzz

Download patch

ref: 5f232419b46551ccceef38f10a0613f09b3a68ef
parent: 1f2af0a020dfe8e740bb50e48d7776e6c9e12d97
author: Anthony House <[email protected]>
date: Sat Nov 24 13:52:55 EST 2018

Did the unsigned one as well.

--- a/mutate.c
+++ b/mutate.c
@@ -76,13 +76,21 @@
 void
 mut_ucharstar(unsigned char** in_val, int *round)
 {
-    if(*round == ROUND_NUM)
+    // if not round 1, free the previously malloc-ed memory
+    if(*round != ROUND_NUM)
+        free(*in_val);
+
+    const int MAX_SIZE = 2048;
+    int size = rand() % MAX_SIZE + 1;
+
+    *in_val = malloc(sizeof(char) * size);
+
+    int i;
+    for(i = 0; i < size; i++)
     {
-        //*in_val = rand();
+        (*in_val)[i] = rand() % 255;
     }
-    else
-    {
-    }
+    (*in_val)[size - 1] = '\0';
 }
 
 int