Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/lib/libc/net Pull up revision 1.22 (requested by he):
details: https://anonhg.NetBSD.org/src/rev/ec2108d8474e
branches: netbsd-1-4
changeset: 471333:ec2108d8474e
user: he <he%NetBSD.org@localhost>
date: Wed Jun 26 21:54:41 2002 +0000
description:
Pull up revision 1.22 (requested by he):
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 9f070682aa8d -r ec2108d8474e lib/libc/net/getnetnamadr.c
--- a/lib/libc/net/getnetnamadr.c Wed Jun 26 21:54:27 2002 +0000
+++ b/lib/libc/net/getnetnamadr.c Wed Jun 26 21:54:41 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getnetnamadr.c,v 1.13 1999/01/20 13:09:57 christos Exp $ */
+/* $NetBSD: getnetnamadr.c,v 1.13.2.1 2002/06/26 21:54:41 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.13 1999/01/20 13:09:57 christos Exp $");
+__RCSID("$NetBSD: getnetnamadr.c,v 1.13.2.1 2002/06/26 21:54:41 he Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -137,9 +137,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];
/*
@@ -161,7 +161,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)
@@ -177,7 +177,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;
@@ -188,7 +188,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