mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-18 20:48:07 +00:00
fix remove_nyx_tmp_workdir function
This commit is contained in:
@ -150,7 +150,7 @@ void *afl_memmem(const void *haystack, size_t haystacklen, const void *needle,
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
/* Nyx helper functions to create and remove tmp workdirs */
|
/* Nyx helper functions to create and remove tmp workdirs */
|
||||||
char* create_nyx_tmp_workdir(void);
|
char* create_nyx_tmp_workdir(void);
|
||||||
void remove_nyx_tmp_workdir(char* nyx_out_dir_path);
|
void remove_nyx_tmp_workdir(afl_forkserver_t *fsrv, char* nyx_out_dir_path);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1381,12 +1381,22 @@ char* create_nyx_tmp_workdir(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Vice versa, we remove the tmp workdir for nyx with this helper function. */
|
/* Vice versa, we remove the tmp workdir for nyx with this helper function. */
|
||||||
void remove_nyx_tmp_workdir(char* nyx_out_dir_path) {
|
void remove_nyx_tmp_workdir(afl_forkserver_t *fsrv, char* nyx_out_dir_path) {
|
||||||
/* Fix me: This is not recursive, so it will always fail. Use a libnyx helper function instead
|
char* workdir_path = alloc_printf("%s/workdir", nyx_out_dir_path);
|
||||||
* to remove the workdir safely (and not risking to wipe the whole filesystem accidentally). */
|
|
||||||
//if (rmdir(nyx_out_dir_path)) {
|
if (access(workdir_path, R_OK) == 0) {
|
||||||
// PFATAL("Unable to remove nyx workdir");
|
if(fsrv->nyx_handlers->nyx_remove_work_dir(workdir_path) != true) {
|
||||||
//}
|
WARNF("Unable to remove nyx workdir (%s)", workdir_path);
|
||||||
free(nyx_out_dir_path);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access(nyx_out_dir_path, R_OK) == 0) {
|
||||||
|
if (rmdir(nyx_out_dir_path)) {
|
||||||
|
WARNF("Unable to remove nyx workdir (%s)", nyx_out_dir_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ck_free(workdir_path);
|
||||||
|
ck_free(nyx_out_dir_path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user