Fix bug in fuzzstub.
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>
Thu, 1 Oct 2015 14:38:10 +0000 (17:38 +0300)
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>
Thu, 1 Oct 2015 14:38:10 +0000 (17:38 +0300)
The fread call always returned a message length of 1 byte,
making the fuzz stub used for external fuzzers useless. The
normal fuzztest.c was unaffected.

Bug found using afl-fuzz.

tests/fuzztest/fuzzstub.c

index ce14b9b..ec9e2af 100644 (file)
@@ -165,7 +165,7 @@ static void run_iteration()
     size_t msglen;
     bool status;
     
-    msglen = fread(buffer, BUFSIZE, 1, stdin);
+    msglen = fread(buffer, 1, BUFSIZE, stdin);
 
     status = do_static_decode(buffer, msglen, false);