From 5815055a7a270758ebe2d10e1e00e18e6ba90670 Mon Sep 17 00:00:00 2001 From: jsteube Date: Tue, 25 Oct 2016 11:30:27 +0200 Subject: [PATCH] Fixes https://github.com/hashcat/hashcat/issues/545 --- src/folder.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/folder.c b/src/folder.c index 4fe097936..4a235e1a1 100644 --- a/src/folder.c +++ b/src/folder.c @@ -18,6 +18,8 @@ #include "event.h" #endif +static const char SLASH[] = "/"; + int sort_by_stringptr (const void *p1, const void *p2) { const char **s1 = (const char **) p1; @@ -248,17 +250,22 @@ int folder_config_init (hashcat_ctx_t *hashcat_ctx, MAYBE_UNUSED const char *ins #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) - if (install_folder == NULL) install_folder = "/"; // makes library use easier + if (install_folder == NULL) install_folder = SLASH; // makes library use easier char *resolved_install_folder = realpath (install_folder, NULL); char *resolved_exec_path = realpath (exec_path, NULL); + if (resolved_install_folder == NULL) resolved_install_folder = hcstrdup (hashcat_ctx, SLASH); + + /* + This causes invalid error out if install_folder (/usr/local/bin) does not exist if (resolved_install_folder == NULL) { event_log_error (hashcat_ctx, "%s: %s", resolved_install_folder, strerror (errno)); return -1; } + */ if (resolved_exec_path == NULL) {