mirror of
https://github.com/hashcat/hashcat.git
synced 2024-11-23 00:28:11 +00:00
Merge pull request #1316 from philsmd/pr/NULLvsDoubleFree
fixed double-free problem if OpenCL/ folder is missing (and e.g. shar…
This commit is contained in:
commit
1ed6576c25
@ -21,6 +21,7 @@
|
||||
|
||||
- Fixed a parser error for mode -m 9820 = MS Office <= 2003 $3, SHA1 + RC4, collider #2
|
||||
- Fixed a problem with changed current working directory, for instance by using --restore together with --remove
|
||||
- Fixed a memory problem that occured when the OpenCL folder was not found and e.g. the shared and session folder were the same
|
||||
|
||||
##
|
||||
## Improvements
|
||||
|
24
src/folder.c
24
src/folder.c
@ -435,10 +435,32 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins
|
||||
hcfree (cwd);
|
||||
|
||||
hcfree (shared_dir);
|
||||
|
||||
// Attention: since hcfree () doesn't set the pointer to NULL, we need to do it externally such that
|
||||
// we prevent double-freeing the same memory address (this happens if e.g. profile_dir == session_dir)
|
||||
|
||||
if (profile_dir == shared_dir) profile_dir = NULL;
|
||||
if (session_dir == shared_dir) session_dir = NULL;
|
||||
|
||||
shared_dir = NULL;
|
||||
|
||||
|
||||
hcfree (profile_dir);
|
||||
hcfree (cpath_real);
|
||||
|
||||
if (session_dir == profile_dir) session_dir = NULL;
|
||||
|
||||
profile_dir = NULL;
|
||||
|
||||
|
||||
hcfree (session_dir);
|
||||
|
||||
session_dir = NULL;
|
||||
|
||||
|
||||
hcfree (cpath_real);
|
||||
|
||||
cpath_real = NULL;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user