summaryrefslogtreecommitdiff
path: root/usr.sbin/pwd_mkdb
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-03-28 16:58:40 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-03-28 16:58:40 +0000
commita8f35ea4a2d6b966f1f322a7427a8a77e3934d3e (patch)
treefcda8f21f42566f4ec5135d2b7965a4d37d8e622 /usr.sbin/pwd_mkdb
parenta9b416a1909ef14cd3265d352f7cc09a1e911108 (diff)
Check strdup() rval for NULL; noticed by mpech@
Diffstat (limited to 'usr.sbin/pwd_mkdb')
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 39db87373d5..be7860d3f56 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_mkdb.c,v 1.32 2002/11/21 22:13:20 millert Exp $ */
+/* $OpenBSD: pwd_mkdb.c,v 1.33 2003/03/28 16:58:39 millert Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@@ -45,7 +45,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "from: @(#)pwd_mkdb.c 8.5 (Berkeley) 4/20/94";
#else
-static char *rcsid = "$OpenBSD: pwd_mkdb.c,v 1.32 2002/11/21 22:13:20 millert Exp $";
+static char *rcsid = "$OpenBSD: pwd_mkdb.c,v 1.33 2003/03/28 16:58:39 millert Exp $";
#endif
#endif /* not lint */
@@ -175,7 +175,8 @@ main(argc, argv)
if (**argv != '/')
errx(1, "%s must be specified as an absolute path", *argv);
- pname = strdup(changedir(*argv, basedir));
+ if ((pname = strdup(changedir(*argv, basedir))) == NULL)
+ err(1, NULL);
/* Open the original password file */
if (!(fp = fopen(pname, "r")))
error(pname);