From: jsteube Date: Fri, 1 Jul 2016 09:24:02 +0000 (+0200) Subject: Fixed a bug where hashcat did not check the return of realpath() and crashes uncontro... X-Git-Url: https://www.flypig.org.uk/git/?p=hashcat.git;a=commitdiff_plain;h=7b84980e4bed7a9a5c76b1c1a40d25d2898dc3ee Fixed a bug where hashcat did not check the return of realpath() and crashes uncontrolled if the path does not exist This fixes https://github.com/hashcat/hashcat/issues/399 --- diff --git a/docs/changes.txt b/docs/changes.txt index cab3958..074d6f6 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -11,6 +11,7 @@ ## - Fixed a bug where hashcat is suppressing --machine-readable output in the final status update +- Fixed a bug where hashcat did not check the return of realpath() and crashes uncontrolled if the path does not exist * changes v2.01 -> v3.00: diff --git a/src/hashcat.c b/src/hashcat.c index 914aab9..47baa0e 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -6139,6 +6139,20 @@ int main (int argc, char **argv) char *resolved_install_folder = realpath (INSTALL_FOLDER, NULL); char *resolved_exec_path = realpath (exec_path, NULL); + if (resolved_install_folder == NULL) + { + log_error ("ERROR: %s: %s", resolved_install_folder, strerror (errno)); + + return (-1); + } + + if (resolved_exec_path == NULL) + { + log_error ("ERROR: %s: %s", resolved_exec_path, strerror (errno)); + + return (-1); + } + char *install_dir = get_install_dir (resolved_exec_path); char *profile_dir = NULL; char *session_dir = NULL;