diff options
Diffstat (limited to 'core/shadow/shadow-strncpy-usage.patch')
-rw-r--r-- | core/shadow/shadow-strncpy-usage.patch | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/core/shadow/shadow-strncpy-usage.patch b/core/shadow/shadow-strncpy-usage.patch new file mode 100644 index 000000000..46df74ace --- /dev/null +++ b/core/shadow/shadow-strncpy-usage.patch @@ -0,0 +1,27 @@ +diff -ur shadow-4.1.4.3.orig/src/login.c shadow-4.1.4.3/src/login.c +--- shadow-4.1.4.3.orig/src/login.c 2011-03-05 22:17:10.032524948 -0800 ++++ shadow-4.1.4.3/src/login.c 2011-03-05 22:17:59.154342059 -0800 +@@ -748,8 +748,9 @@ + sizeof (loginprompt), + _("%s login: "), hostn); + } else { ++ loginprompt[sizeof (loginprompt) - 1] = '\0'; + strncpy (loginprompt, _("login: "), +- sizeof (loginprompt)); ++ sizeof (loginprompt) - 1); + } + + retcode = pam_set_item (pamh, PAM_USER_PROMPT, loginprompt); +diff -ur shadow-4.1.4.3.orig/src/usermod.c shadow-4.1.4.3/src/usermod.c +--- shadow-4.1.4.3.orig/src/usermod.c 2011-03-05 22:17:10.029191265 -0800 ++++ shadow-4.1.4.3/src/usermod.c 2011-03-05 22:18:42.665576968 -0800 +@@ -182,7 +182,8 @@ + struct tm *tp; + + if ((negativ != NULL) && (date < 0)) { +- strncpy (buf, negativ, maxsize); ++ buf[maxsize - 1] = '\0'; ++ strncpy (buf, negativ, maxsize - 1); + } else { + time_t t = (time_t) date; + tp = gmtime (&t); |