From 4b3d39623c3b3f4a15e74552c3d0aed163bc3af9 Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 14 Feb 2017 20:05:44 +0100 Subject: [PATCH] Restore: Add some checks on the rd->cwd variable in restore case --- docs/changes.txt | 1 + src/restore.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index b3fe2a74d..3b8a7f3f5 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -74,6 +74,7 @@ - OpenCL Kernel: Move kernel binary buffer from heap to stack memory - OpenCL Kernel: Refactored read_kernel_binary to load only a single kernel for a single device - Outfile Check: Fixed a memory leak for failed outfile reads +- Restore: Add some checks on the rd->cwd variable in restore case - Rule Engine: Fixed several memory leaks in case loading of rules failed - Session Management: Fixed several memory leaks in case profile- or install-folder setup failed - OpenCL Header: Updated CL_* errorcode to OpenCL 1.2 standard diff --git a/src/restore.c b/src/restore.c index 6dc542a80..030c2261b 100644 --- a/src/restore.c +++ b/src/restore.c @@ -97,6 +97,20 @@ static int read_restore (hashcat_ctx_t *hashcat_ctx) fclose (fp); + if (hc_path_exist (rd->cwd) == false) + { + event_log_error (hashcat_ctx, "%s: %s", rd->cwd, strerror (errno)); + + return -1; + } + + if (hc_path_is_directory (rd->cwd) == false) + { + event_log_error (hashcat_ctx, "%s: %s", rd->cwd, strerror (errno)); + + return -1; + } + event_log_warning (hashcat_ctx, "Changing current working directory to '%s'", rd->cwd); event_log_warning (hashcat_ctx, NULL);