summarylogtreecommitdiffstats
path: root/shadow-strncpy-usage.patch
blob: 5aba8fa01f9487a8b1b83e8f0b6c3c7e36605511 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
diff -u shadow-4.1.5/src/usermod.c.orig shadow-4.1.5/src/usermod.c
--- shadow-4.1.5/src/usermod.c.orig	2012-02-13 08:19:43.792146449 -0500
+++ shadow-4.1.5/src/usermod.c	2012-02-13 08:21:19.375114500 -0500
@@ -182,7 +182,7 @@
 	struct tm *tp;
 
 	if (date < 0) {
-		strncpy (buf, "never", maxsize);
+		strncpy (buf, "never", maxsize - 1);
 	} else {
 		time_t t = (time_t) date;
 		tp = gmtime (&t);
diff -u shadow-4.1.5/src/login.c.orig shadow-4.1.5/src/login.c
--- shadow-4.1.5/src/login.c.orig	2012-02-13 08:19:50.951994454 -0500
+++ shadow-4.1.5/src/login.c	2012-02-13 08:21:04.490430937 -0500
@@ -752,7 +752,8 @@
 			          _("%s login: "), hostn);
 		} else {
 			strncpy (loginprompt, _("login: "),
-			         sizeof (loginprompt));
+			         sizeof (loginprompt) - 1);
+			loginprompt[sizeof (loginprompt) - 1] = '\0';
 		}
 
 		retcode = pam_set_item (pamh, PAM_USER_PROMPT, loginprompt);