SHA256
1
0
forked from pool/hashcat
hashcat/0001-fixes-issue-10-compiler-warning-for-possible-memory-.patch

53 lines
1.8 KiB
Diff
Raw Normal View History

From 1a79f0b2912388cff61d6571da69217dbd877fe4 Mon Sep 17 00:00:00 2001
From: philsmd <philsmd@hashcat.net>
Date: Sat, 5 Dec 2015 11:32:46 +0100
Subject: [PATCH] fixes issue #10: compiler warning for possible memory problem
(-m 11400 only)
---
docs/changes.txt | 7 +++++++
src/hashcat-cli.c | 11 +++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/docs/changes.txt b/docs/changes.txt
index 7f6675d..9c7ecea 100644
--- a/docs/changes.txt
+++ b/docs/changes.txt
@@ -1,3 +1,10 @@
+* changes v2.00 -> v2.01:
+
+type.: Feature
+file.: Host
+desc.: Fix a possible memory problem for hash type -m 11400 = SIP digest authentication (MD5)
+issue: 10
+
* changes v0.50 -> v2.00:
type: Project
diff --git a/src/hashcat-cli.c b/src/hashcat-cli.c
index 8c9c951..0ede840 100644
--- a/src/hashcat-cli.c
+++ b/src/hashcat-cli.c
@@ -13159,9 +13159,16 @@ void load_hashes (FILE *fp, db_t *db, engine_parameter_t *engine_parameter)
memset (&salt_search->additional_plain_struct[i].buf, 0, additional_plain_max_len);
- snprintf (additional_plain_ptr, additional_plain_max_len + 1, "%s:%s:", user_pos, realm_pos);
+ int buf_len = snprintf (additional_plain_ptr, additional_plain_max_len, "%s:%s:", user_pos, realm_pos);
- salt_search->additional_plain_struct[i].len = user_len + 1 + realm_len + 1;
+ int expected_buf_len = user_len + 1 + realm_len + 1;
+
+ if (buf_len != expected_buf_len) // this should never occur because buffer is large enough, but we better have a check anyway
+ {
+ log_warning ("username and realm (%d bytes) do not fit within the buffer (%d bytes)", expected_buf_len, buf_len);
+ }
+
+ salt_search->additional_plain_struct[i].len = buf_len;
}
salt_t *salt;
--
2.4.3