From: deraadt Date: Sun, 13 Apr 1997 05:08:24 +0000 (+0000) Subject: buf oflow; bitblt X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=e1ef3f59d31ab6b570679ca40ea4cd3c33afa99e;p=openbsd buf oflow; bitblt --- 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 @@ -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++)); diff --git a/lib/libc/net/inet_pton.c b/lib/libc/net/inet_pton.c index 8ffe81ed12f..46b4b24819c 100644 --- a/lib/libc/net/inet_pton.c +++ b/lib/libc/net/inet_pton.c @@ -1,4 +1,4 @@ -/* $OpenBSD: inet_pton.c,v 1.1 1997/03/13 19:07:33 downsj Exp $ */ +/* $OpenBSD: inet_pton.c,v 1.2 1997/04/13 05:08:24 deraadt Exp $ */ /* Copyright (c) 1996 by Internet Software Consortium. * @@ -20,7 +20,7 @@ #if 0 static char rcsid[] = "$From: inet_pton.c,v 8.7 1996/08/05 08:31:35 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: inet_pton.c,v 1.1 1997/03/13 19:07:33 downsj Exp $"; +static char rcsid[] = "$OpenBSD: inet_pton.c,v 1.2 1997/04/13 05:08:24 deraadt Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -100,12 +100,12 @@ inet_pton4(src, dst) if (new > 255) return (0); - *tp = new; if (! saw_digit) { if (++octets > 4) return (0); saw_digit = 1; } + *tp = new; } else if (ch == '.' && saw_digit) { if (octets == 4) return (0);