diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-13 05:11:08 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-04-13 05:11:08 +0000 |
commit | 138a38dd288af8da58b26f04e98399e9c6822a4f (patch) | |
tree | 2d4e47568a3365c6d7d067c94cc5a7fe52047be3 /lib/libc | |
parent | f832b8a3221289d902d377512178d18598b94be1 (diff) |
buf oflow; bitblt
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/getpwent.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/gen/getpwent.c b/lib/libc/gen/getpwent.c index db556d05251..7cab9efbccc 100644 --- a/lib/libc/gen/getpwent.c +++ b/lib/libc/gen/getpwent.c @@ -33,7 +33,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getpwent.c,v 1.8 1996/10/16 09:24:21 downsj Exp $"; +static char rcsid[] = "$OpenBSD: getpwent.c,v 1.9 1997/04/13 05:11:07 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -961,8 +961,12 @@ __hashpw(key) if ((_pw_db->get)(_pw_db, key, &data, 0)) return(0); p = (char *)data.data; - if (data.size > max && !(line = realloc(line, (max += 1024)))) - return(0); + if (data.size > max) { + max = data.size + 256; + line = realloc(line, max); + if (line == NULL) + return 0; + } t = line; #define EXPAND(e) e = t; while ((*t++ = *p++)); |