cdd12ed
diff -up shadow-4.1.4.2/lib/commonio.c.fixes shadow-4.1.4.2/lib/commonio.c
cdd12ed
--- shadow-4.1.4.2/lib/commonio.c.fixes	2009-09-07 15:51:28.312139467 +0200
cdd12ed
+++ shadow-4.1.4.2/lib/commonio.c	2009-09-07 15:52:00.788140456 +0200
cdd12ed
@@ -710,7 +710,7 @@ commonio_sort (struct commonio_db *db, i
cdd12ed
 	db->tail->prev = entries[n - 1];
cdd12ed
 	db->tail->next = NULL;
cdd12ed
 
cdd12ed
-	for (i = 1; i < n; i++) {
cdd12ed
+	for (i = 1; i < (n-1); i++) {
cdd12ed
 		entries[i]->prev = entries[i - 1];
cdd12ed
 		entries[i]->next = entries[i + 1];
cdd12ed
 	}
cdd12ed
diff -up shadow-4.1.4.2/libmisc/cleanup.c.fixes shadow-4.1.4.2/libmisc/cleanup.c
cdd12ed
--- shadow-4.1.4.2/libmisc/cleanup.c.fixes	2009-09-07 15:52:22.449035388 +0200
cdd12ed
+++ shadow-4.1.4.2/libmisc/cleanup.c	2009-09-07 15:55:06.632033653 +0200
cdd12ed
@@ -107,7 +107,7 @@ void del_cleanup (cleanup_function pcf)
cdd12ed
 	assert (i
cdd12ed
 
cdd12ed
 	/* Move the rest of the cleanup functions */
cdd12ed
-	for (; i
cdd12ed
+	for (; i<(CLEANUP_FUNCTIONS - 1); i++) {
cdd12ed
 		/* Make sure the cleanup function was specified only once */
cdd12ed
 		assert (cleanup_functions[i+1] != pcf);
cdd12ed
 
cdd12ed
diff -up shadow-4.1.4.2/libmisc/limits.c.fixes shadow-4.1.4.2/libmisc/limits.c
cdd12ed
--- shadow-4.1.4.2/libmisc/limits.c.fixes	2009-09-07 15:55:38.734034494 +0200
cdd12ed
+++ shadow-4.1.4.2/libmisc/limits.c	2009-09-07 15:56:10.545044166 +0200
cdd12ed
@@ -167,7 +167,7 @@ static int check_logins (const char *nam
cdd12ed
 	 * includes the user who is currently trying to log in.
cdd12ed
 	 */
cdd12ed
 	if (count > limit) {
cdd12ed
-		SYSLOG ((LOG_WARN, "Too many logins (max %d) for %s\n",
cdd12ed
+		SYSLOG ((LOG_WARN, "Too many logins (max %lu) for %s\n",
cdd12ed
 			 limit, name));
cdd12ed
 		return LOGIN_ERROR_LOGIN;
cdd12ed
 	}
cdd12ed
diff -up shadow-4.1.4.2/libmisc/utmp.c.fixes shadow-4.1.4.2/libmisc/utmp.c
cdd12ed
--- shadow-4.1.4.2/libmisc/utmp.c.fixes	2009-09-07 15:56:30.534033865 +0200
cdd12ed
+++ shadow-4.1.4.2/libmisc/utmp.c	2009-09-07 16:11:23.049069289 +0200
cdd12ed
@@ -56,7 +56,7 @@ static bool is_my_tty (const char *tty)
cdd12ed
 	/* full_tty shall be at least sizeof utmp.ut_line + 5 */
cdd12ed
 	char full_tty[200];
cdd12ed
 	/* tmptty shall be bigger than full_tty */
cdd12ed
-	static char tmptty[sizeof (full_tty)+1];
cdd12ed
+	static char tmptty[sizeof (full_tty)+1] = "";
cdd12ed
 
cdd12ed
 	if ('/' != *tty) {
cdd12ed
 		(void) snprintf (full_tty, sizeof full_tty, "/dev/%s", tty);
cdd12ed
@@ -71,7 +71,7 @@ static bool is_my_tty (const char *tty)
cdd12ed
 		}
cdd12ed
 	}
cdd12ed
 
cdd12ed
-	if (NULL == tmptty) {
cdd12ed
+	if ('\0' == tmptty[0]) {
cdd12ed
 		(void) puts (_("Unable to determine your tty name."));
cdd12ed
 		exit (EXIT_FAILURE);
cdd12ed
 	} else if (strncmp (tty, tmptty, sizeof (tmptty)) != 0) {
cdd12ed
@@ -200,7 +200,6 @@ static void updwtmpx (const char *filena
cdd12ed
 		strcpy (hostname, host);
cdd12ed
 #ifdef HAVE_STRUCT_UTMP_UT_HOST
cdd12ed
 	} else if (   (NULL != ut)
cdd12ed
-	           && (NULL != ut->ut_host)
cdd12ed
 	           && ('\0' != ut->ut_host[0])) {
cdd12ed
 		hostname = (char *) xmalloc (sizeof (ut->ut_host) + 1);
cdd12ed
 		strncpy (hostname, ut->ut_host, sizeof (ut->ut_host));