summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-07-06 22:19:40 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-07-06 22:19:40 +0000
commit4b02dda7d181e19ca15797151926b87efa2f89eb (patch)
tree6c34efb7c9fb6619e36d698ce33310c9ad5ac564
parentfb1e8ae000c813073e63f20d16abfb26717f5828 (diff)
oops, fix getpwent() use of wrong buffers
found by alexander.schrijver
-rw-r--r--lib/libc/gen/getpwent.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c
index 7c5dc89b9d9..f369c22e83e 100644
--- a/lib/libc/gen/getpwent.c
+++ b/lib/libc/gen/getpwent.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getpwent.c,v 1.36 2008/06/25 14:51:27 millert Exp $ */
+/* $OpenBSD: getpwent.c,v 1.37 2008/07/06 22:19:39 deraadt Exp $ */
/*
* Copyright (c) 2008 Theo de Raadt
* Copyright (c) 1988, 1993
@@ -314,7 +314,7 @@ getpwent(void)
static char *name = NULL;
char *map;
#endif
- char bf[1 + sizeof(_pw_keynum)], pwbuf[_PW_BUF_LEN];
+ char bf[1 + sizeof(_pw_keynum)];
struct passwd *pw = NULL;
DBT key;
@@ -438,7 +438,8 @@ again:
bcopy((char *)&_pw_keynum, &bf[1], sizeof(_pw_keynum));
key.data = (u_char *)bf;
key.size = 1 + sizeof(_pw_keynum);
- if (__hashpw(&key, pwbuf, sizeof pwbuf, &_pw_passwd, &_pw_flags)) {
+ if (__hashpw(&key, _pw_string, sizeof _pw_string,
+ &_pw_passwd, &_pw_flags)) {
#ifdef YP
static long __yppbuf[_PW_BUF_LEN / sizeof(long)];
const char *user, *host, *dom;