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; }