From 1d5dbab258d2013d9cfea490e4c458cd0f139647 Mon Sep 17 00:00:00 2001 From: philsmd Date: Thu, 17 Aug 2017 07:51:19 +0200 Subject: [PATCH] fixes #1278: allow the '#' character within the username field of DCC2 hashes --- docs/changes.txt | 1 + src/interface.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index 3a84a179e..05cb3f8df 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -26,6 +26,7 @@ - Fixed the version number used in the restore file header - Fixed the parsing of command line options. It doesn't show two times the same error about an invalid option anymore. - Fixed the estimated time value whenever the value is very large and overflows +- Fixed the parsing of DCC2 hashes by allowing the "#" character within the user name ## ## Improvements diff --git a/src/interface.c b/src/interface.c index 399038f84..c0fa95abc 100644 --- a/src/interface.c +++ b/src/interface.c @@ -3063,7 +3063,9 @@ int dcc2_parse_hash (u8 *input_buf, u32 input_len, hash_t *hash_buf, MAYBE_UNUSE salt_pos++; - u8 *digest_pos = (u8 *) strchr ((const char *) salt_pos, '#'); + // search last '#' from the end since the username can consist of a '#' too + + u8 *digest_pos = (u8 *) strrchr ((const char *) salt_pos, '#'); if (digest_pos == NULL) return (PARSER_SEPARATOR_UNMATCHED);