Skip to content

Instantly share code, notes, and snippets.

@personnumber3377
Created April 13, 2023 12:26
Show Gist options
  • Save personnumber3377/9dd028ec9e1d6408845d220d9955baf5 to your computer and use it in GitHub Desktop.
Save personnumber3377/9dd028ec9e1d6408845d220d9955baf5 to your computer and use it in GitHub Desktop.
Fuzzing patch for curl
diff --git a/src/tool_main.c b/src/tool_main.c
index 2274bd0f4..701c178af 100644
--- a/src/tool_main.c
+++ b/src/tool_main.c
@@ -50,7 +50,7 @@
#include "tool_vms.h"
#include "tool_main.h"
#include "tool_libinfo.h"
-
+#include "../../AFLplusplus/utils/argv_fuzzing/argv-fuzz-inl.h"
/*
* This is low-level hard-hacking memory leak tracking and similar. Using
* the library level code from this client-side is ugly, but we do this
@@ -240,7 +240,7 @@ int main(int argc, char *argv[])
CURLcode result = CURLE_OK;
struct GlobalConfig global;
memset(&global, 0, sizeof(global));
-
+ AFL_INIT_ARGV();
#ifdef WIN32
/* Undocumented diagnostic option to list the full paths of all loaded
modules. This is purposely pre-init. */
@@ -292,7 +292,9 @@ int main(int argc, char *argv[])
#ifdef __VMS
vms_special_exit(result, vms_show);
#else
- return (int)result;
+ // MODIFIED: This must always return 0 because otherwise we get a false positive crash.
+ return 0;
+ //return (int)result;
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment