summaryrefslogtreecommitdiffstats
path: root/usr.sbin/pwd_mkdb
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-03-28 16:58:39 +0000
committermillert <millert@openbsd.org>2003-03-28 16:58:39 +0000
commit6b6e920d6c657a29e6e01418a82f3759d9abf3b3 (patch)
tree4f2b860bb8ad9ee883a8c7f5590be20bde490cdd /usr.sbin/pwd_mkdb
parentWe were malloc()ing one byte more than we needed; Alexander Farber (diff)
downloadwireguard-openbsd-6b6e920d6c657a29e6e01418a82f3759d9abf3b3.tar.xz
wireguard-openbsd-6b6e920d6c657a29e6e01418a82f3759d9abf3b3.zip
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);