5ab9c0
Index: shadow-4.5/src/faillog.c
5ab9c0
===================================================================
5ab9c0
--- shadow-4.5.orig/src/faillog.c
5ab9c0
+++ shadow-4.5/src/faillog.c
5ab9c0
@@ -163,10 +163,14 @@ static void print_one (/*@null@*/const s
5ab9c0
 	}
5ab9c0
 
5ab9c0
 	tm = localtime (&fl.fail_time);
5ab9c0
+	if (tm == NULL) {
5ab9c0
+		cp = "(unknown)";
5ab9c0
+	} else {
5ab9c0
 #ifdef HAVE_STRFTIME
5ab9c0
-	strftime (ptime, sizeof (ptime), "%D %H:%M:%S %z", tm);
5ab9c0
-	cp = ptime;
5ab9c0
+		strftime (ptime, sizeof (ptime), "%D %H:%M:%S %z", tm);
5ab9c0
+		cp = ptime;
5ab9c0
 #endif
5ab9c0
+	}
5ab9c0
 	printf ("%-9s   %5d    %5d   ",
5ab9c0
 	        pw->pw_name, fl.fail_cnt, fl.fail_max);
5ab9c0
 	/* FIXME: cp is not defined ifndef HAVE_STRFTIME */
5ab9c0
Index: shadow-4.5/src/chage.c
5ab9c0
===================================================================
5ab9c0
--- shadow-4.5.orig/src/chage.c
5ab9c0
+++ shadow-4.5/src/chage.c
5ab9c0
@@ -168,6 +168,10 @@ static void date_to_str (char *buf, size
5ab9c0
 	struct tm *tp;
5ab9c0
 
5ab9c0
 	tp = gmtime (&date);
5ab9c0
+	if (tp == NULL) {
5ab9c0
+		(void) snprintf (buf, maxsize, "(unknown)");
5ab9c0
+		return;
5ab9c0
+	}
5ab9c0
 #ifdef HAVE_STRFTIME
5ab9c0
 	(void) strftime (buf, maxsize, "%Y-%m-%d", tp);
5ab9c0
 #else
5ab9c0
Index: shadow-4.5/src/lastlog.c
5ab9c0
===================================================================
5ab9c0
--- shadow-4.5.orig/src/lastlog.c
5ab9c0
+++ shadow-4.5/src/lastlog.c
5ab9c0
@@ -158,13 +158,17 @@ static void print_one (/*@null@*/const s
5ab9c0
 
5ab9c0
 	ll_time = ll.ll_time;
5ab9c0
 	tm = localtime (&ll_time);
5ab9c0
+	if (tm == NULL) {
5ab9c0
+		cp = "(unknown)";
5ab9c0
+	} else {
5ab9c0
 #ifdef HAVE_STRFTIME
5ab9c0
-	strftime (ptime, sizeof (ptime), "%a %b %e %H:%M:%S %z %Y", tm);
5ab9c0
-	cp = ptime;
5ab9c0
+		strftime (ptime, sizeof (ptime), "%a %b %e %H:%M:%S %z %Y", tm);
5ab9c0
+		cp = ptime;
5ab9c0
 #else
5ab9c0
-	cp = asctime (tm);
5ab9c0
-	cp[24] = '\0';
5ab9c0
+		cp = asctime (tm);
5ab9c0
+		cp[24] = '\0';
5ab9c0
 #endif
5ab9c0
+	}
5ab9c0
 
5ab9c0
 	if (ll.ll_time == (time_t) 0) {
5ab9c0
 		cp = _("**Never logged in**\0");
5ab9c0
Index: shadow-4.5/src/passwd.c
5ab9c0
===================================================================
5ab9c0
--- shadow-4.5.orig/src/passwd.c
5ab9c0
+++ shadow-4.5/src/passwd.c
5ab9c0
@@ -455,6 +455,9 @@ static /*@observer@*/const char *date_to
5ab9c0
 	struct tm *tm;
5ab9c0
 
5ab9c0
 	tm = gmtime (&t);
5ab9c0
+	if (tm == NULL) {
5ab9c0
+		return "(unknown)";
5ab9c0
+	}
5ab9c0
 #ifdef HAVE_STRFTIME
5ab9c0
 	(void) strftime (buf, sizeof buf, "%m/%d/%Y", tm);
5ab9c0
 #else				/* !HAVE_STRFTIME */
5ab9c0
Index: shadow-4.5/src/usermod.c
5ab9c0
===================================================================
5ab9c0
--- shadow-4.5.orig/src/usermod.c
5ab9c0
+++ shadow-4.5/src/usermod.c
5ab9c0
@@ -210,6 +210,10 @@ static void date_to_str (/*@unique@*//*@
5ab9c0
 	} else {
5ab9c0
 		time_t t = (time_t) date;
5ab9c0
 		tp = gmtime (&t);
5ab9c0
+		if (tp == NULL) {
5ab9c0
+			strncpy (buf, "unknown", maxsize);
5ab9c0
+			return;
5ab9c0
+		}
5ab9c0
 #ifdef HAVE_STRFTIME
5ab9c0
 		strftime (buf, maxsize, "%Y-%m-%d", tp);
5ab9c0
 #else