patch to cracklib 2.7 based on a patch for cracklib 2.9 from https://bugzilla.redhat.com/attachment.cgi?id=1188599 : It is not safe to pass words longer than STRINGSIZE further to cracklib so the longbuffer cannot be longer than STRINGSIZE. --- ./cracklib/fascist.c.orig 1997-12-31 10:26:46.000000000 +0000 +++ ./cracklib/fascist.c 2016-10-27 19:00:46.000000000 +0000 @@ -490,7 +490,7 @@ FascistGecos(password, uid) char gbuffer[STRINGSIZE]; char tbuffer[STRINGSIZE]; char *uwords[STRINGSIZE]; - char longbuffer[STRINGSIZE * 2]; + char longbuffer[STRINGSIZE]; if (!(pwp = getpwuid(uid))) { @@ -573,38 +573,47 @@ FascistGecos(password, uid) { 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"); + } } } }