Blame SOURCES/pam-1.1.8-opasswd-tolerant.patch

b10636
diff --git a/modules/pam_pwhistory/opasswd.c b/modules/pam_pwhistory/opasswd.c
b10636
index 836d713..c36628e 100644
b10636
--- a/modules/pam_pwhistory/opasswd.c
b10636
+++ b/modules/pam_pwhistory/opasswd.c
b10636
@@ -82,10 +82,15 @@ parse_entry (char *line, opwd *data)
b10636
 {
b10636
   const char delimiters[] = ":";
b10636
   char *endptr;
b10636
+  char *count;
b10636
 
b10636
   data->user = strsep (&line, delimiters);
b10636
   data->uid = strsep (&line, delimiters);
b10636
-  data->count = strtol (strsep (&line, delimiters), &endptr, 10);
b10636
+  count = strsep (&line, delimiters);
b10636
+  if (data->user == NULL || data->uid == NULL || count == NULL)
b10636
+      return 1;
b10636
+
b10636
+  data->count = strtol (count, &endptr, 10);
b10636
   if (endptr != NULL && *endptr != '\0')
b10636
       return 1;
b10636
 
b10636
diff --git a/modules/pam_unix/passverify.c b/modules/pam_unix/passverify.c
b10636
index 4840bb2..7f7bc49 100644
b10636
--- a/modules/pam_unix/passverify.c
b10636
+++ b/modules/pam_unix/passverify.c
b10636
@@ -639,11 +639,23 @@ save_old_password(pam_handle_t *pamh, const char *forwho, const char *oldpass,
b10636
 		continue;
b10636
 	    buf[strlen(buf) - 1] = '\0';
b10636
 	    s_luser = strtok_r(buf, ":", &sptr);
b10636
+	    if (s_luser == NULL) {
b10636
+		found = 0;
b10636
+		continue;
b10636
+	    }
b10636
 	    s_uid = strtok_r(NULL, ":", &sptr);
b10636
+	    if (s_uid == NULL) {
b10636
+		found = 0;
b10636
+		continue;
b10636
+	    }
b10636
 	    s_npas = strtok_r(NULL, ":", &sptr);
b10636
+	    if (s_npas == NULL) {
b10636
+		found = 0;
b10636
+		continue;
b10636
+	    }
b10636
 	    s_pas = strtok_r(NULL, ":", &sptr);
b10636
 	    npas = strtol(s_npas, NULL, 10) + 1;
b10636
-	    while (npas > howmany) {
b10636
+	    while (npas > howmany && s_pas != NULL) {
b10636
 		s_pas = strpbrk(s_pas, ",");
b10636
 		if (s_pas != NULL)
b10636
 		    s_pas++;