From f362bdd0e4a92bc9936084953d791c54a5865abc Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 6 Aug 2005 17:03:57 +0000 Subject: fix use after free, netbsd pr 30832, from phirerunner@comcast.net --- lib/libc/gen/getnetgrent.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/libc') 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 @@ -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); -- cgit v1.2.3