From 6624a978d14f957913dd1bd91b84eb2d7e81cf24 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Mon, 27 Jan 2025 23:24:45 +0100 Subject: [PATCH] fix inline comments in dictionary files. The extrac checks broke the earlier logic, we now look for a hash sign in the current line if found we try to add a null terminator before the hash sign until we find a hexdigit. Apply old logic on the new shorter line. --- client/src/fileutils.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/src/fileutils.c b/client/src/fileutils.c index efd5d9ef4..db151f3a1 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -2398,8 +2398,18 @@ int loadFileDICTIONARY_safe_ex(const char *preferredName, const char *suffix, vo continue; } + char *pos = strstr(line, "#"); + if (pos) { + // we found a inline comment, add a null terminator, until we hit hexadecimal char + while (isxdigit(pos[0]) == 0) { + pos[0] = 0x00; + --pos; + } + } + // larger keys than expected is skipped if (strlen(line) > keylen) { + PrintAndLogEx(INFO, "larger %zu - %s", strlen(line), line); continue; }