Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/lib/libc/net Pull up revision 1.22 (requested by itojun):
details: https://anonhg.NetBSD.org/src/rev/f6d78ac8c9a6
branches: netbsd-1-5
changeset: 493132:f6d78ac8c9a6
user: he <he%NetBSD.org@localhost>
date: Wed Jun 26 16:13:43 2002 +0000
description:
Pull up revision 1.22 (requested by itojun):
Fix remote buffer overrun on hostbuf[]. Also fix up logic of
buffer handling.
diffstat:
lib/libc/net/getnetnamadr.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (57 lines):
diff -r fcd4593ca2af -r f6d78ac8c9a6 lib/libc/net/getnetnamadr.c
--- a/lib/libc/net/getnetnamadr.c Wed Jun 26 16:13:25 2002 +0000
+++ b/lib/libc/net/getnetnamadr.c Wed Jun 26 16:13:43 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getnetnamadr.c,v 1.19 2000/01/22 22:19:14 mycroft Exp $ */
+/* $NetBSD: getnetnamadr.c,v 1.19.4.1 2002/06/26 16:13:43 he Exp $ */
/* Copyright (c) 1993 Carlos Leandro and Rui Salgueiro
* Dep. Matematica Universidade de Coimbra, Portugal, Europe
@@ -47,7 +47,7 @@
static char sccsid_[] = "from getnetnamadr.c 1.4 (Coimbra) 93/06/03";
static char rcsid[] = "Id: getnetnamadr.c,v 8.8 1997/06/01 20:34:37 vixie Exp ";
#else
-__RCSID("$NetBSD: getnetnamadr.c,v 1.19 2000/01/22 22:19:14 mycroft Exp $");
+__RCSID("$NetBSD: getnetnamadr.c,v 1.19.4.1 2002/06/26 16:13:43 he Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -139,9 +139,9 @@
u_char *cp;
int n;
u_char *eom;
- int type, class, buflen, ancount, qdcount, haveanswer, i, nchar;
+ int type, class, ancount, qdcount, haveanswer, i, nchar;
char aux1[30], aux2[30], ans[30], *in, *st, *pauxt, *bp, **ap,
- *paux1 = &aux1[0], *paux2 = &aux2[0], flag = 0;
+ *paux1 = &aux1[0], *paux2 = &aux2[0], flag = 0, *ep;
static char netbuf[PACKETSZ];
_DIAGASSERT(answer != NULL);
@@ -165,7 +165,7 @@
ancount = ntohs(hp->ancount); /* #/records in the answer section */
qdcount = ntohs(hp->qdcount); /* #/entries in the question section */
bp = netbuf;
- buflen = sizeof(netbuf);
+ ep = netbuf + sizeof(netbuf);
cp = answer->buf + HFIXEDSZ;
if (!qdcount) {
if (hp->aa)
@@ -181,7 +181,7 @@
net_entry.n_aliases = net_aliases;
haveanswer = 0;
while (--ancount >= 0 && cp < eom) {
- n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ n = dn_expand(answer->buf, eom, cp, bp, ep - bp);
if ((n < 0) || !res_dnok(bp))
break;
cp += n;
@@ -192,7 +192,7 @@
cp += INT32SZ; /* TTL */
GETSHORT(n, cp);
if (class == C_IN && type == T_PTR) {
- n = dn_expand(answer->buf, eom, cp, bp, buflen);
+ n = dn_expand(answer->buf, eom, cp, bp, ep - bp);
if ((n < 0) || !res_hnok(bp)) {
cp += n;
return (NULL);
Home |
Main Index |
Thread Index |
Old Index