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/lib/isc Pull up revision 1.4 (requested by it...



details:   https://anonhg.NetBSD.org/src/rev/805439e12dfa
branches:  netbsd-1-6
changeset: 528222:805439e12dfa
user:      lukem <lukem%NetBSD.org@localhost>
date:      Fri Jun 28 11:54:22 2002 +0000

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

diffstat:

 dist/bind/lib/isc/ctl_clnt.c |  41 +++++++++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 10 deletions(-)

diffs (136 lines):

diff -r 770061725940 -r 805439e12dfa dist/bind/lib/isc/ctl_clnt.c
--- a/dist/bind/lib/isc/ctl_clnt.c      Fri Jun 28 11:54:05 2002 +0000
+++ b/dist/bind/lib/isc/ctl_clnt.c      Fri Jun 28 11:54:22 2002 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: ctl_clnt.c,v 1.3 2001/01/27 07:22:04 itojun Exp $      */
+/*     $NetBSD: ctl_clnt.c,v 1.3.2.1 2002/06/28 11:54:22 lukem Exp $   */
 
 #if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "Id: ctl_clnt.c,v 8.15 2000/11/14 01:10:36 vixie Exp";
+static const char rcsid[] = "Id: ctl_clnt.c,v 8.17 2001/06/06 00:33:35 marka Exp";
 #endif /* not lint */
 
 /*
@@ -57,8 +57,9 @@
 /* Macros. */
 
 #define donefunc_p(ctx) ((ctx).donefunc != NULL)
-#define arpacode_p(line) (isdigit(line[0]) && isdigit(line[1]) && \
-                         isdigit(line[2]))
+#define arpacode_p(line) (isdigit((unsigned char)(line[0])) && \
+                         isdigit((unsigned char)(line[1])) && \
+                         isdigit((unsigned char)(line[2])))
 #define arpacont_p(line) (line[3] == '-')
 #define arpadone_p(line) (line[3] == ' ' || line[3] == '\t' || \
                          line[3] == '\r' || line[3] == '\0')
@@ -137,6 +138,7 @@
        static const char me[] = "ctl_client";
        static const int on = 1;
        struct ctl_cctx *ctx;
+       struct sockaddr *captmp;
 
        if (logger == NULL)
                logger = ctl_logger;
@@ -170,18 +172,19 @@
        }
        if (cap != NULL) {
                if (setsockopt(ctx->sock, SOL_SOCKET, SO_REUSEADDR,
-                              (char *)&on, sizeof on) != 0) {
+                              (const char *)&on, sizeof on) != 0) {
                        (*ctx->logger)(ctl_warning,
                                       "%s: setsockopt(REUSEADDR): %s",
                                       me, strerror(errno));
                }
-               if (bind(ctx->sock, cap, cap_len) < 0) {
+               DE_CONST(cap, captmp);
+               if (bind(ctx->sock, captmp, cap_len) < 0) {
                        (*ctx->logger)(ctl_error, "%s: bind: %s", me,
                                       strerror(errno));
                        goto fatal;
                }
        }
-       if (evConnect(lev, ctx->sock, (struct sockaddr *)sap, sap_len,
+       if (evConnect(lev, ctx->sock, (const struct sockaddr *)sap, sap_len,
                      conn_done, ctx, &ctx->coID) < 0) {
                (*ctx->logger)(ctl_error, "%s: evConnect(fd %d): %s",
                               me, ctx->sock, strerror(errno));
@@ -221,7 +224,7 @@
 {
        struct ctl_tran *tran;
        char *pc;
-       int n;
+       unsigned int n;
 
        switch (ctx->state) {
        case destroyed:
@@ -245,7 +248,8 @@
        memcpy(tran->outbuf.text, cmd, len);
        tran->outbuf.used = len;
        for (pc = tran->outbuf.text, n = 0; n < tran->outbuf.used; pc++, n++)
-               if (!isascii(*pc) || !isprint(*pc))
+               if (!isascii((unsigned char)*pc) ||
+                   !isprint((unsigned char)*pc))
                        *pc = '\040';
        start_write(ctx);
        return (0);
@@ -276,6 +280,7 @@
        static const char me[] = "isc/ctl_clnt::start_write";
        struct ctl_tran *tran;
        struct iovec iov[2], *iovp = iov;
+       char * tmp;
 
        REQUIRE(ctx->state == connecting || ctx->state == connected);
        /* If there is a write in progress, don't try to write more yet. */
@@ -299,7 +304,8 @@
                return;
        /* Marshall a newline-terminated message and clock it out. */
        *iovp++ = evConsIovec(tran->outbuf.text, tran->outbuf.used);
-       *iovp++ = evConsIovec("\r\n", 2);
+       DE_CONST("\r\n", tmp);
+       *iovp++ = evConsIovec(tmp, 2);
        if (evWrite(ctx->ev, ctx->sock, iov, iovp - iov,
                    write_done, tran, &ctx->wrID) < 0) {
                (*ctx->logger)(ctl_error, "%s: evWrite: %s", me,
@@ -389,6 +395,12 @@
        struct ctl_cctx *ctx = uap;
        struct ctl_tran *tran;
 
+       UNUSED(ev);
+       UNUSED(la);
+       UNUSED(lalen);
+       UNUSED(ra);
+       UNUSED(ralen);
+
        ctx->coID.opaque = NULL;
        if (fd < 0) {
                (*ctx->logger)(ctl_error, "%s: evConnect: %s", me,
@@ -418,6 +430,9 @@
        struct ctl_tran *tran = (struct ctl_tran *)uap;
        struct ctl_cctx *ctx = tran->ctx;
 
+       UNUSED(lev);
+       UNUSED(fd);
+
        ctx->wrID.opaque = NULL;
        if (ctx->tiID.opaque != NULL)
                touch_timer(ctx);
@@ -461,6 +476,8 @@
        ssize_t n;
        char *eos;
 
+       UNUSED(ev);
+
        REQUIRE(ctx != NULL);
        REQUIRE(fd >= 0);
        REQUIRE(evmask == EV_READ);
@@ -576,6 +593,10 @@
        static const char me[] = "isc/ctl_clnt::timer";
        struct ctl_cctx *ctx = uap;
 
+       UNUSED(ev);
+       UNUSED(due);
+       UNUSED(itv);
+
        ctx->tiID.opaque = NULL;
        (*ctx->logger)(ctl_error, "%s: timeout after %u seconds while %s", me,
                       ctx->timeout.tv_sec, state_names[ctx->state]);



Home | Main Index | Thread Index | Old Index