diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-07-23 19:36:48 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2008-07-23 19:36:48 +0000 |
commit | f12b9c901d32a155dec7e75845d17831ebb11110 (patch) | |
tree | 24e81b5eb046c4dc8298ebda74b6779a53da5e30 /lib/libc | |
parent | 7cc2faf530b8dee66d0933fb9f1f131dba656cf7 (diff) |
Avoid an occasional double free in getpwent() which corrupted memory. It
happened only in the case of a + record indicating to use YP, but with ypbind
not actually running. Problem found by pyr; solution found with millert
ok millert pyr
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/getpwent.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index f369c22e83e..48b4e6f5e6a 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getpwent.c,v 1.37 2008/07/06 22:19:39 deraadt Exp $ */ +/* $OpenBSD: getpwent.c,v 1.38 2008/07/23 19:36:47 deraadt Exp $ */ /* * Copyright (c) 2008 Theo de Raadt * Copyright (c) 1988, 1993 @@ -332,7 +332,7 @@ again: if (__getpwent_has_yppw && (__ypmode != YPMODE_NONE)) { const char *user, *host, *dom; int keylen, datalen, r, s; - char *key, *data; + char *key, *data = NULL; if (!__ypdomain) { if (_yp_check(&__ypdomain) == 0) { @@ -352,7 +352,6 @@ again: __ypmode = YPMODE_NONE; if (data) free(data); - data = NULL; goto again; } __ypcurrent = key; @@ -371,7 +370,6 @@ again: } bcopy(data, __ypline, datalen); free(data); - data = NULL; break; case YPMODE_NETGRP: s = getnetgrent(&host, &user, &dom); @@ -397,7 +395,6 @@ again: } bcopy(data, __ypline, datalen); free(data); - data = NULL; break; case YPMODE_USER: if (name) { @@ -414,7 +411,6 @@ again: } bcopy(data, __ypline, datalen); free(data); - data = NULL; } else { /* XXX */ __ypmode = YPMODE_NONE; goto again; |