]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
set global search path, so that the fuzzer can find things
authorAlan T. DeKok <aland@freeradius.org>
Thu, 19 Jan 2023 22:21:25 +0000 (17:21 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Thu, 19 Jan 2023 22:21:25 +0000 (17:21 -0500)
src/bin/fuzzer.c

index e897104a1157a631425ec1db532a0d065eb9b1fc..6312341a8bcf476d955d04de7a63d1c6a95681c1 100644 (file)
@@ -165,6 +165,14 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
        if (!dict_dir) dict_dir = DICTDIR;
        if (!lib_dir) lib_dir = LIBDIR;
 
+       /*
+        *      Set the global search path for all dynamic libraries we load.
+        */
+       if (dl_search_global_path_set(libdir) < 0) {
+               fr_perror("fuzzer: Failed setting library path);
+               fr_exit_now(EXIT_FAILURE);
+       }
+
        /*
         *      When jobs=N is specified the fuzzer spawns worker processes via
         *      a shell. We have removed any -D dictdir argument that were
@@ -202,7 +210,6 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
                fr_perror("fuzzer: Failed initializing library loader");
                fr_exit_now(EXIT_FAILURE);
        }
-       dl_search_path_prepend(dl_loader, lib_dir);
 
        snprintf(buffer, sizeof(buffer), "libfreeradius-%s", proto);
        dl = dl_by_name(dl_loader, buffer, NULL, false);