diff options
author | msmith <msmith@FreeBSD.org> | 1998-10-29 23:16:24 +0000 |
---|---|---|
committer | msmith <msmith@FreeBSD.org> | 1998-10-29 23:16:24 +0000 |
commit | 36c3e6804b9e0892a3195895e2e8c7f35c9518b5 (patch) | |
tree | 1290fd2583b15334b3a20245209ef92b30a96de7 /lib/libc/gen/getpwent.c | |
parent | 2b9a0363f57e7556ab085913a8b71d62e806faad (diff) | |
download | FreeBSD-src-36c3e6804b9e0892a3195895e2e8c7f35c9518b5.zip FreeBSD-src-36c3e6804b9e0892a3195895e2e8c7f35c9518b5.tar.gz |
Prevent buffer overflow in getpwnam()
PR: bin/8176
Submitted by: Archie Cobbs <archie@whistle.com>
Diffstat (limited to 'lib/libc/gen/getpwent.c')
-rw-r--r-- | lib/libc/gen/getpwent.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index 02ec190..e24de81 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -153,8 +153,8 @@ getpwnam(name) return((struct passwd *)NULL); bf[0] = _PW_KEYBYNAME; - len = strlen(name); - bcopy(name, bf + 1, MIN(len, UT_NAMESIZE)); + len = MIN(strlen(name), UT_NAMESIZE); + bcopy(name, bf + 1, len); key.data = (u_char *)bf; key.size = len + 1; rval = __hashpw(&key); |