$OpenBSD: patch-src_rawSHA1_ng_fmt_c,v 1.2 2014/06/04 13:52:40 sthen Exp $

revert https://github.com/magnumripper/JohnTheRipper/commit/ef2b184a571851ecf0ddc509ae387d54209eaf6b; segfaults in tests

--- src/rawSHA1_ng_fmt.c.orig.port	Wed Jun  4 08:49:27 2014
+++ src/rawSHA1_ng_fmt.c	Wed Jun  4 11:10:28 2014
@@ -406,7 +406,7 @@ static void sha1_fmt_set_key(char *key, int index)
 
 static char * sha1_fmt_get_key(int index)
 {
-    static uint32_t key[5];
+    static uint32_t key[4];
 
     // This function is not hot, we can do this slowly. First, restore
     // endianness.
@@ -415,8 +415,8 @@ static char * sha1_fmt_get_key(int index)
     key[2] = __builtin_bswap32(M[index][2]);
     key[3] = __builtin_bswap32(M[index][3]);
 
-    // Skip backwards until we hit the trailing bit, then remove it.
-    memset(strrchr((char *)(key), 0x80), 0x00, 1);
+    // Skip backwards until we hit the trailing bit
+    memset(memrchr(key, 0x80, sizeof key), 0x00, 1);
 
     return (char *) key;
 }
