diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-09-29 15:52:29 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-09-29 15:52:29 +0000 |
commit | 1e720692ab14e6311c6a84cf4e331c08b82985a7 (patch) | |
tree | a5706094dd61fbd557786fdd9a497cf4e4fcd811 /lib | |
parent | babce86fc29ca8fbb262463524c72e50a36739e9 (diff) |
unchecked strdup; ok henning; spotted by jjy2+@pitt.edu
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 12 |
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; |