read_defaults has the thing for strtonum to chew on in cp, not
authordlg <dlg@openbsd.org>
Fri, 24 Apr 2015 08:08:29 +0000 (08:08 +0000)
committerdlg <dlg@openbsd.org>
Fri, 24 Apr 2015 08:08:29 +0000 (08:08 +0000)
optarg.

fixes a segfault introduced by the atoi to strtonum change and
reported by ajacatout@

usr.sbin/user/user.c

index 2026c36..4500375 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: user.c,v 1.102 2015/04/23 17:11:42 millert Exp $ */
+/* $OpenBSD: user.c,v 1.103 2015/04/24 08:08:29 dlg Exp $ */
 /* $NetBSD: user.c,v 1.69 2003/04/14 17:40:07 agc Exp $ */
 
 /*
@@ -815,7 +815,7 @@ read_defaults(user_t *up)
                                }
                                up->u_preserve = (strncmp(cp, "true", 4) == 0) ? 1 :
                                                  (strncmp(cp, "yes", 3) == 0) ? 1 :
-                                                  strtonum(optarg, INT_MIN, INT_MAX, NULL);
+                                                  strtonum(cp, INT_MIN, INT_MAX, NULL);
                        } else if (strncmp(s, "expire", 6) == 0) {
                                for (cp = s + 6 ; isspace((unsigned char)*cp); cp++) {
                                }