Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-6]: src/dist/bind/bin/nslookup Pull up revision 1.3 (requested ...



details:   https://anonhg.NetBSD.org/src/rev/5fccb1ef2c3b
branches:  netbsd-1-6
changeset: 528164:5fccb1ef2c3b
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:37:27 2002 +0000

description:
Pull up revision 1.3 (requested by itojun in ticket #387):
Update to BIND 8.3.3.  Fixes buffer overrun in resolver code.

diffstat:

 dist/bind/bin/nslookup/subr.c |  55 +++++++++++++++++++++++++-----------------
 1 files changed, 33 insertions(+), 22 deletions(-)

diffs (131 lines):

diff -r 4b2c66f622b9 -r 5fccb1ef2c3b dist/bind/bin/nslookup/subr.c
--- a/dist/bind/bin/nslookup/subr.c     Fri Jun 28 11:37:18 2002 +0000
+++ b/dist/bind/bin/nslookup/subr.c     Fri Jun 28 11:37:27 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr.c,v 1.2 2001/01/27 07:22:01 itojun Exp $  */
+/*     $NetBSD: subr.c,v 1.2.2.1 2002/06/28 11:37:27 lukem Exp $       */
 
 /*
  * Copyright (c) 1985, 1989
@@ -55,7 +55,7 @@
 
 #ifndef lint
 static const char sccsid[] = "@(#)subr.c       5.24 (Berkeley) 3/2/91";
-static const char rcsid[] = "Id: subr.c,v 8.14 2000/12/23 08:14:48 vixie Exp";
+static const char rcsid[] = "Id: subr.c,v 8.16 2002/04/09 05:55:24 marka Exp";
 #endif /* not lint */
 
 /*
@@ -122,7 +122,7 @@
  */
 
 SIG_FN
-IntrHandler()
+IntrHandler(int sig)
 {
     extern jmp_buf env;
 #if defined(BSD) && BSD >= 199006 && !defined(RISCOS_BSD) && !defined(__osf__)
@@ -131,6 +131,8 @@
 #endif
     extern void ListHost_close(void);
 
+    UNUSED(sig);
+
     SendRequest_close();
     ListHost_close();
     if (filePtr != NULL && filePtr != stdout) {
@@ -235,13 +237,15 @@
 void
 PrintHostInfo(file, title, hp)
        FILE    *file;
-       char    *title;
+       const char      *title;
        register HostInfo *hp;
 {
+       register AddrInfo       **ap;
        register char           **cp;
        register ServerInfo     **sp;
        char                    comma;
        int                     i;
+       char buf[80];
 
        fprintf(file, "%-7s  %s", title, hp->name);
 
@@ -253,14 +257,18 @@
            }
            comma = ' ';
            i = 0;
-           for (cp = hp->addrList; cp && *cp; cp++) {
+           for (ap = hp->addrList; ap && *ap; ap++) {
                i++;
                if (i > 4) {
                    fprintf(file, "\n\t");
                    comma = ' ';
                    i = 0;
                }
-               fprintf(file,"%c %s", comma, inet_ntoa(*(struct in_addr *)*cp));
+               if (inet_ntop((*ap)->addrType, (*ap)->addr,
+                             buf, sizeof(buf)) != NULL) {
+                       fprintf(file,"%c %s", comma, buf);
+               } else
+                       fprintf(file,"%c <UNKNOWN>", comma);
                comma = ',';
            }
        }
@@ -289,15 +297,18 @@
 
                comma = ' ';
                i = 0;
-               for (cp = (*sp)->addrList; cp && *cp && **cp; cp++) {
+               for (ap = (*sp)->addrList; ap && *ap; ap++) {
                    i++;
                    if (i > 4) {
                        fprintf(file, "\n\t");
                        comma = ' ';
                        i = 0;
                    }
-                   fprintf(file,
-                       "%c %s", comma, inet_ntoa(*(struct in_addr *)*cp));
+                   if (inet_ntop((*ap)->addrType, (*ap)->addr,
+                             buf, sizeof(buf)) != NULL)
+                       fprintf(file,"%c %s", comma, buf);
+                   else
+                       fprintf(file,"%c <UNKNOWN>", comma);
                    comma = ',';
                }
                fprintf(file, "\n\t");
@@ -389,21 +400,21 @@
  */
 
 const struct res_sym error_syms[] = {
-       { NOERROR,      "Success" },
-       { FORMERR,      "Format error" },
-       { SERVFAIL,     "Server failed" },
-       { NXDOMAIN,     "Non-existent host/domain" },
-       { NOTIMP,       "Not implemented" },
-       { REFUSED,      "Query refused" },
+       { NOERROR,      "Success", NULL },
+       { FORMERR,      "Format error", NULL },
+       { SERVFAIL,     "Server failed", NULL },
+       { NXDOMAIN,     "Non-existent host/domain", NULL },
+       { NOTIMP,       "Not implemented", NULL },
+       { REFUSED,      "Query refused", NULL },
 #ifdef NOCHANGE
-       { NOCHANGE,     "No change" },
+       { NOCHANGE,     "No change", NULL },
 #endif
-       { TIME_OUT,     "Timed out" },
-       { NO_INFO,      "No information" },
-       { ERROR,        "Unspecified error" },
-       { NONAUTH,      "Non-authoritative answer" },
-       { NO_RESPONSE,  "No response from server" },
-       { 0,            NULL }
+       { TIME_OUT,     "Timed out", NULL },
+       { NO_INFO,      "No information", NULL },
+       { ERROR,        "Unspecified error", NULL },
+       { NONAUTH,      "Non-authoritative answer", NULL },
+       { NO_RESPONSE,  "No response from server", NULL },
+       { 0,            NULL, NULL }
 };
 
 const char *



Home | Main Index | Thread Index | Old Index