summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-04-01 16:28:03 +0000
committermillert <millert@openbsd.org>2003-04-01 16:28:03 +0000
commiteeea6988c6f60d7ad3d3f48dc401933bc4f10b2a (patch)
tree0e60bbd188bed522fb9ee0d3bdc37bf1acb6c8ee /lib/libutil
parentUpdate to sudo 1.6.7p1; fixes false positives in the oflow detection (diff)
downloadwireguard-openbsd-eeea6988c6f60d7ad3d3f48dc401933bc4f10b2a.tar.xz
wireguard-openbsd-eeea6988c6f60d7ad3d3f48dc401933bc4f10b2a.zip
Throw an error if the username field is empty; noticed by mpech@
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/passwd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index 75d082c6325..fce7f2a1d97 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.38 2003/03/30 21:10:27 deraadt Exp $ */
+/* $OpenBSD: passwd.c,v 1.39 2003/04/01 16:28:03 millert Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$OpenBSD: passwd.c,v 1.38 2003/03/30 21:10:27 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: passwd.c,v 1.39 2003/04/01 16:28:03 millert Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -515,8 +515,9 @@ pw_scan(bp, pw, flags)
if (flags != (int *)NULL)
*flags = 0;
- if (!(pw->pw_name = strsep(&bp, ":"))) /* login */
+ if (!(p = strsep(&bp, ":")) || *p == '\0') /* login */
goto fmt;
+ pw->pw_name = p;
root = !strcmp(pw->pw_name, "root");
if (!(pw->pw_passwd = strsep(&bp, ":"))) /* passwd */