shadow-strncpy-usage.patch 906 B

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