From 18d48ef94ec1acffc5313ea0ae1f50863e848d7a Mon Sep 17 00:00:00 2001
From: magnum <magnum>
Date: Sun, 4 Dec 2011 18:29:40 +0100
Subject: [PATCH] NT2 format, truncation bugfix for non-SSE builds

---
 src/NT2_fmt_plug.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/NT2_fmt_plug.c b/src/NT2_fmt_plug.c
index 48ea72d..3643c2b 100644
--- a/src/NT2_fmt_plug.c
+++ b/src/NT2_fmt_plug.c
@@ -365,6 +365,8 @@ key_cleaning_enc:
 	                                PLAINTEXT_LENGTH + 1,
 	                                (unsigned char*)_key,
 	                                strlen(_key)) << 1;
+	if (saved_key_length <= 0)
+		saved_key_length = strlen16(saved_key);
 #endif
 }
 
@@ -472,6 +474,8 @@ static void set_key_utf8(char *_key, int index)
 	                                 PLAINTEXT_LENGTH + 1,
 	                                 (unsigned char*)_key,
 	                                 strlen(_key)) << 1;
+	if (saved_key_length <= 0)
+		saved_key_length = strlen16(saved_key);
 #endif
 }
 
-- 
1.7.5.4

