summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-09-29 15:52:28 +0000
committerderaadt <deraadt@openbsd.org>2003-09-29 15:52:28 +0000
commita697aa5a271cc138738b7037b731d1785c0f6364 (patch)
treeb24e6172b641419936253711f367e628bb53c8e2 /lib/libc
parentExperimental support for serverworks csb6 third channel inspired by (diff)
downloadwireguard-openbsd-a697aa5a271cc138738b7037b731d1785c0f6364.tar.xz
wireguard-openbsd-a697aa5a271cc138738b7037b731d1785c0f6364.zip
unchecked strdup; ok henning; spotted by jjy2+@pitt.edu
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/getnetgrent.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c
index aec19041911..73cd0818a43 100644
--- a/lib/libc/gen/getnetgrent.c
+++ b/lib/libc/gen/getnetgrent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getnetgrent.c,v 1.13 2002/07/06 03:07:41 deraadt Exp $ */
+/* $OpenBSD: getnetgrent.c,v 1.14 2003/09/29 15:52:28 deraadt Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@@ -32,7 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: getnetgrent.c,v 1.13 2002/07/06 03:07:41 deraadt Exp $";
+static char *rcsid = "$OpenBSD: getnetgrent.c,v 1.14 2003/09/29 15:52:28 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -702,7 +702,7 @@ int
innetgr(grp, host, user, domain)
const char *grp, *host, *user, *domain;
{
- char *ypdom = NULL;
+ char *ypdom = NULL, *grpdup;
#ifdef YP
char *line = NULL;
#endif
@@ -738,9 +738,13 @@ innetgr(grp, host, user, domain)
if (domain != NULL)
return 0;
+ grpdup = strdup(grp);
+ if (grpdup == NULL)
+ return (0);
+
/* Too bad need the slow recursive way */
sl = _ng_sl_init();
- found = in_find(ypdom, sl, strdup(grp), host, user, domain);
+ found = in_find(ypdom, sl, grpdup, host, user, domain);
_ng_sl_free(sl, 1);
return found;