about summary refs log tree commit diff
path: root/examples/persistent_demo/persistent_demo_new.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-26 15:57:15 +0200
committervan Hauser <vh@thc.org>2020-05-26 15:57:15 +0200
commit9dd0b7c6de72100ceaf99bba3b0705f952b36de0 (patch)
tree2e34711cdc6e463c849432262892459aa59f156b /examples/persistent_demo/persistent_demo_new.c
parent1cae68dde32abf9c7fe83cb9a91890deba973834 (diff)
downloadafl++-9dd0b7c6de72100ceaf99bba3b0705f952b36de0.tar.gz
make examples better
Diffstat (limited to 'examples/persistent_demo/persistent_demo_new.c')
-rw-r--r--examples/persistent_demo/persistent_demo_new.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/examples/persistent_demo/persistent_demo_new.c b/examples/persistent_demo/persistent_demo_new.c
index fffd40b6..36411e13 100644
--- a/examples/persistent_demo/persistent_demo_new.c
+++ b/examples/persistent_demo/persistent_demo_new.c
@@ -30,27 +30,6 @@
 
 __AFL_FUZZ_INIT();
 
-unsigned int crc32_for_byte(unsigned int r) {
-
-  for (int j = 0; j < 8; ++j)
-    r = (r & 1 ? 0 : (unsigned int)0xEDB88320L) ^ r >> 1;
-  return r ^ (unsigned int)0xFF000000L;
-
-}
-
-unsigned int crc32(unsigned char *data, unsigned int n_bytes) {
-
-  static unsigned char table[0x100];
-  unsigned int         crc = 0;
-  if (!*table)
-    for (unsigned int i = 0; i < 0x100; ++i)
-      table[i] = crc32_for_byte(i);
-  for (unsigned int i = 0; i < n_bytes; ++i)
-    crc = table[(unsigned char)crc ^ (data)[i]] ^ crc >> 8;
-  return crc;
-
-}
-
 /* Main entry point. */
 
 int main(int argc, char **argv) {
@@ -70,7 +49,7 @@ int main(int argc, char **argv) {
     len = __AFL_FUZZ_TESTCASE_LEN;
 
     /* do we have enough data? */
-    if (len < 8) return 0;
+    if (len < 8) continue;
 
     if (buf[0] == 'f') {