summary refs log tree commit diff
path: root/gnu/packages/patches/cracklib-CVE-2016-6318.patch
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2016-08-16 22:33:39 -0400
committerLeo Famulari <leo@famulari.name>2016-08-17 00:40:39 -0400
commit53dcbbec07cb06147e86a8a186e47cf6155ce7dc (patch)
tree3568c8ded1cb99576866f7b82e807d951271bb50 /gnu/packages/patches/cracklib-CVE-2016-6318.patch
parent231313f76a2ee64a90381c37a9080ecafadb9865 (diff)
downloadguix-53dcbbec07cb06147e86a8a186e47cf6155ce7dc.tar.gz
gnu: cracklib: Fix CVE-2016-6318.
* gnu/packages/patches/cracklib-CVE-2016-6318.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/password-utils.scm (cracklib)[source]: Use the patch.
Diffstat (limited to 'gnu/packages/patches/cracklib-CVE-2016-6318.patch')
-rw-r--r--gnu/packages/patches/cracklib-CVE-2016-6318.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/gnu/packages/patches/cracklib-CVE-2016-6318.patch b/gnu/packages/patches/cracklib-CVE-2016-6318.patch
new file mode 100644
index 0000000000..4806ecaae9
--- /dev/null
+++ b/gnu/packages/patches/cracklib-CVE-2016-6318.patch
@@ -0,0 +1,95 @@
+Fix CVE-2016-6318.
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-6318
+
+Patch copied from Red Hat:
+
+https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2016-6318
+https://bugzilla.redhat.com/attachment.cgi?id=1188599&action=diff
+
+It is not safe to pass words longer than STRINGSIZE further to cracklib
+so the longbuffer cannot be longer than STRINGSIZE.
+diff -up cracklib-2.9.0/lib/fascist.c.longgecos cracklib-2.9.0/lib/fascist.c
+--- cracklib-2.9.0/lib/fascist.c.longgecos	2014-02-06 16:03:59.000000000 +0100
++++ cracklib-2.9.0/lib/fascist.c	2016-08-08 12:05:40.279235815 +0200
+@@ -515,7 +515,7 @@ FascistGecosUser(char *password, const c
+     char gbuffer[STRINGSIZE];
+     char tbuffer[STRINGSIZE];
+     char *uwords[STRINGSIZE];
+-    char longbuffer[STRINGSIZE * 2];
++    char longbuffer[STRINGSIZE];
+ 
+     if (gecos == NULL)
+ 	gecos = "";
+@@ -596,38 +596,47 @@ FascistGecosUser(char *password, const c
+     {
+ 	for (i = 0; i < j; i++)
+ 	{
+-	    strcpy(longbuffer, uwords[i]);
+-	    strcat(longbuffer, uwords[j]);
+-
+-	    if (GTry(longbuffer, password))
++	    if (strlen(uwords[i]) + strlen(uwords[j]) < STRINGSIZE)
+ 	    {
+-		return _("it is derived from your password entry");
+-	    }
+-
+-	    strcpy(longbuffer, uwords[j]);
+-	    strcat(longbuffer, uwords[i]);
++		strcpy(longbuffer, uwords[i]);
++		strcat(longbuffer, uwords[j]);
+ 
+-	    if (GTry(longbuffer, password))
+-	    {
+-		return _("it's derived from your password entry");
++		if (GTry(longbuffer, password))
++		{
++		    return _("it is derived from your password entry");
++		}
++
++		strcpy(longbuffer, uwords[j]);
++		strcat(longbuffer, uwords[i]);
++
++		if (GTry(longbuffer, password))
++		{
++		   return _("it's derived from your password entry");
++		}
+ 	    }
+ 
+-	    longbuffer[0] = uwords[i][0];
+-	    longbuffer[1] = '\0';
+-	    strcat(longbuffer, uwords[j]);
+-
+-	    if (GTry(longbuffer, password))
++	    if (strlen(uwords[j]) < STRINGSIZE - 1)
+ 	    {
+-		return _("it is derivable from your password entry");
++		longbuffer[0] = uwords[i][0];
++		longbuffer[1] = '\0';
++		strcat(longbuffer, uwords[j]);
++
++		if (GTry(longbuffer, password))
++		{
++		    return _("it is derivable from your password entry");
++		}
+ 	    }
+ 
+-	    longbuffer[0] = uwords[j][0];
+-	    longbuffer[1] = '\0';
+-	    strcat(longbuffer, uwords[i]);
+-
+-	    if (GTry(longbuffer, password))
++	    if (strlen(uwords[i]) < STRINGSIZE - 1)
+ 	    {
+-		return _("it's derivable from your password entry");
++		longbuffer[0] = uwords[j][0];
++		longbuffer[1] = '\0';
++		strcat(longbuffer, uwords[i]);
++
++		if (GTry(longbuffer, password))
++		{
++		    return _("it's derivable from your password entry");
++		}
+ 	    }
+ 	}
+     }