aboutsummaryrefslogtreecommitdiff
path: root/projects/freeradius/patch.diff
diff options
context:
space:
mode:
Diffstat (limited to 'projects/freeradius/patch.diff')
-rw-r--r--projects/freeradius/patch.diff64
1 files changed, 64 insertions, 0 deletions
diff --git a/projects/freeradius/patch.diff b/projects/freeradius/patch.diff
new file mode 100644
index 000000000..5436820d8
--- /dev/null
+++ b/projects/freeradius/patch.diff
@@ -0,0 +1,64 @@
+diff --git a/configure.ac b/configure.ac
+index 56e9600..ad488e8 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -21,7 +21,7 @@ dnl #
+ dnl #############################################################
+
+ AC_PREREQ([2.59])
+-export CFLAGS LIBS LDFLAGS CPPFLAGS
++#export CFLAGS LIBS LDFLAGS CPPFLAGS
+
+ AC_INIT([freeradius],[$]Id[$],[http://bugs.freeradius.org],,[http://www.freeradius.org])
+ AC_CONFIG_SRCDIR([src/bin/radiusd.c])
+@@ -185,7 +185,7 @@ dnl # -g3 so nice things like macro values are included. Other arguments are
+ dnl # added later when we know what compiler were using.
+ dnl #
+ if test "x$developer" = "xyes"; then
+- : ${CFLAGS=-g3}
++ : ${CFLAGS="$CFLAGS -g3"}
+ fi
+
+ dnl #
+
+diff --git a/src/bin/fuzzer.c b/src/bin/fuzzer.c
+index 9c2eb50..82d6fd6 100644
+--- a/src/bin/fuzzer.c
++++ b/src/bin/fuzzer.c
+@@ -125,7 +125,21 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
+ }
+ }
+
+- if (!dict_dir) dict_dir = DICTDIR;
++ int free_dict = 0;
++ int free_lib = 0;
++ if (!dict_dir) {
++ dict_dir = malloc(strlen((*argv)[0]) + 1);
++ memcpy(dict_dir, (*argv)[0], strlen((*argv)[0]) + 1);
++ snprintf(strrchr(dict_dir, '/'), 6, "/dict");
++ free_dict = 1;
++ }
++ if (!lib_dir) {
++ lib_dir = malloc(strlen((*argv)[0]) + 1);
++ memcpy(lib_dir, (*argv)[0], strlen((*argv)[0]) + 1);
++ snprintf(strrchr(lib_dir, '/'), 5, "/lib");
++ setenv("FR_LIBRARY_PATH", lib_dir, 1);
++ free_lib = 1;
++ }
+
+ /*
+ * When jobs=N is specified the fuzzer spawns worker processes via
+@@ -182,6 +196,13 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
+
+ init = true;
+
++ if (free_lib) {
++ free(lib_dir);
++ }
++ if (free_dict) {
++ free(dict_dir);
++ }
++
+ return 1;
+ }
+