<commit_before>diff --git a/src/bin/fuzzer.c b/src/bin/fuzzer.c
index 9c2eb50..6352aa0 100644
--- a/src/bin/fuzzer.c
+++ b/src/bin/fuzzer.c
@@ -125,7 +125,17 @@ int LLVMFuzzerInitialize(int *argc, char ***argv)
                }
        }

-       if (!dict_dir) dict_dir = DICTDIR;
+       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");
+       }
+       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);
+       }

        /*
         *      When jobs=N is specified the fuzzer spawns worker processes via<commit_msg>Fixes leak in freeradius patch for target (#5893)<commit_after>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;
 }
 
{'fraction_non_alphanumeric': 0.18169398907103826, 'fraction_numerical': 0.04143897996357013, 'mean_word_length': 1.8130601792573624, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6621437', 'n_tokens_mistral': 872, 'n_tokens_neox': 795, 'n_words': 147}