• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1diff --git a/configure.ac b/configure.ac
2index 56e9600..ad488e8 100644
3--- a/configure.ac
4+++ b/configure.ac
5@@ -21,7 +21,7 @@ dnl #
6 dnl #############################################################
7
8 AC_PREREQ([2.59])
9-export CFLAGS LIBS LDFLAGS CPPFLAGS
10+#export CFLAGS LIBS LDFLAGS CPPFLAGS
11
12 AC_INIT([freeradius],[$]Id[$],[http://bugs.freeradius.org],,[http://www.freeradius.org])
13 AC_CONFIG_SRCDIR([src/bin/radiusd.c])
14@@ -185,7 +185,7 @@ dnl #  -g3 so nice things like macro values are included. Other arguments are
15 dnl #  added later when we know what compiler were using.
16 dnl #
17 if test "x$developer" = "xyes"; then
18-  : ${CFLAGS=-g3}
19+  : ${CFLAGS="$CFLAGS -g3"}
20 fi
21
22 dnl #
23
24diff --git a/src/bin/fuzzer.c b/src/bin/fuzzer.c
25index 9c2eb50..82d6fd6 100644
26--- a/src/bin/fuzzer.c
27+++ b/src/bin/fuzzer.c
28@@ -125,7 +125,21 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
29                }
30        }
31
32-       if (!dict_dir) dict_dir = DICTDIR;
33+       int free_dict = 0;
34+       int free_lib = 0;
35+       if (!dict_dir) {
36+               dict_dir = malloc(strlen((*argv)[0]) + 1);
37+               memcpy(dict_dir, (*argv)[0], strlen((*argv)[0]) + 1);
38+               snprintf(strrchr(dict_dir, '/'), 6, "/dict");
39+               free_dict = 1;
40+       }
41+       if (!lib_dir) {
42+                lib_dir = malloc(strlen((*argv)[0]) + 1);
43+                memcpy(lib_dir, (*argv)[0], strlen((*argv)[0]) + 1);
44+                snprintf(strrchr(lib_dir, '/'), 5, "/lib");
45+                setenv("FR_LIBRARY_PATH", lib_dir, 1);
46+                free_lib = 1;
47+       }
48
49        /*
50         *      When jobs=N is specified the fuzzer spawns worker processes via
51@@ -182,6 +196,13 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
52
53        init = true;
54
55+        if (free_lib) {
56+                free(lib_dir);
57+        }
58+        if (free_dict) {
59+                free(dict_dir);
60+        }
61+
62        return 1;
63 }
64
65