From 33d7fa4585247cd2247a1ffa032ad245836c6edb Mon Sep 17 00:00:00 2001
From: Jan Dittberner <jan@dittberner.info>
Date: Thu, 25 Aug 2016 17:17:53 +0200
Subject: [PATCH 07/13] Fix a buffer overflow processing long words

A buffer overflow processing long words has been discovered. This commit
applies the patch from
https://build.opensuse.org/package/view_file/Base:System/cracklib/0004-overflow-processing-long-words.patch
by Howard Guo.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835386 and
http://www.openwall.com/lists/oss-security/2016/08/23/8
---
 src/NEWS        | 1 +
 src/lib/rules.c | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/fascist.c b/lib/fascist.c
index d193cc0..3a2aa46 100644
--- a/lib/fascist.c
+++ b/lib/fascist.c
@@ -438,7 +438,7 @@
     int i;
     int len;
     char *mp;
-    char area[STRINGSIZE];
+    char area[STRINGSIZE * 2] = {0};
     char revarea[STRINGSIZE];
 
     /* use destructors to turn password into rawtext */
diff --git a/lib/rules.c b/lib/rules.c
index d193cc0..3a2aa46 100644
--- a/lib/rules.c
+++ b/lib/rules.c
@@ -437,8 +437,7 @@
 {
     int limit;
     register char *ptr;
-    char area2[STRINGSIZE];
-    area[0] = '\0';
+    char area2[STRINGSIZE * 2] = {0};
     strcpy(area, input);
 
     for (ptr = control; *ptr; ptr++)
