diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-08-06 17:03:57 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2005-08-06 17:03:57 +0000 |
commit | f362bdd0e4a92bc9936084953d791c54a5865abc (patch) | |
tree | 8500eac20d7d272875ef027c662261ec2bb5467d | |
parent | 118d4ab15d367ac6efc5fcf0bf7bcc837ecdf655 (diff) |
fix use after free, netbsd pr 30832, from phirerunner@comcast.net
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 51a04a5c9c9..dc074fae3f9 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getnetgrent.c,v 1.15 2004/05/18 02:05:52 jfb Exp $ */ +/* $OpenBSD: getnetgrent.c,v 1.16 2005/08/06 17:03:56 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.15 2004/05/18 02:05:52 jfb Exp $"; +static char *rcsid = "$OpenBSD: getnetgrent.c,v 1.16 2005/08/06 17:03:56 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -367,8 +367,8 @@ addgroup(char *ypdom, struct stringlist *sl, char *grp) #endif /* check for cycles */ if (_ng_sl_find(sl, grp) != NULL) { - free(grp); _warnx("netgroup: Cycle in group `%s'", grp); + free(grp); return; } _ng_sl_add(sl, grp); @@ -445,8 +445,8 @@ in_find(char *ypdom, struct stringlist *sl, char *grp, const char *host, #endif /* check for cycles */ if (_ng_sl_find(sl, grp) != NULL) { - free(grp); _warnx("netgroup: Cycle in group `%s'", grp); + free(grp); return 0; } _ng_sl_add(sl, grp); |