Source-Changes-HG archive

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

[src/trunk]: src/dist/bind/lib/irs kill one more use of tandem variable.



details:   https://anonhg.NetBSD.org/src/rev/ccff1bb718da
branches:  trunk
changeset: 533355:ccff1bb718da
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Jun 28 06:20:55 2002 +0000

description:
kill one more use of tandem variable.

diffstat:

 dist/bind/lib/irs/dns_nw.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (54 lines):

diff -r a92fa6d3f13b -r ccff1bb718da dist/bind/lib/irs/dns_nw.c
--- a/dist/bind/lib/irs/dns_nw.c        Fri Jun 28 06:11:47 2002 +0000
+++ b/dist/bind/lib/irs/dns_nw.c        Fri Jun 28 06:20:55 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dns_nw.c,v 1.3 2002/06/28 06:11:53 itojun Exp $        */
+/*     $NetBSD: dns_nw.c,v 1.4 2002/06/28 06:20:55 itojun Exp $        */
 
 /*
  * Copyright (c) 1996-1999 by Internet Software Consortium.
@@ -524,37 +524,37 @@
 static int
 make1101inaddr(const u_char *net, int bits, char *name, int size) {
        int n, m;
+       char *ep;
+
+       ep = name + size;
 
        /* Zero fill any whole bytes left out of the prefix. */
        for (n = (32 - bits) / 8; n > 0; n--) {
-               if (size < (int)(sizeof "0."))
+               if (ep - name < (int)(sizeof "0."))
                        goto emsgsize;
                m = SPRINTF((name, "0."));
                name += m;
-               size -= m;
        }
 
        /* Format the partial byte, if any, within the prefix. */
        if ((n = bits % 8) != 0) {
-               if (size < (int)(sizeof "255."))
+               if (ep - name < (int)(sizeof "255."))
                        goto emsgsize;
                m = SPRINTF((name, "%u.",
                             net[bits / 8] & ~((1 << (8 - n)) - 1)));
                name += m;
-               size -= m;
        }
 
        /* Format the whole bytes within the prefix. */
        for (n = bits / 8; n > 0; n--) {
-               if (size < (int)(sizeof "255."))
+               if (ep - name < (int)(sizeof "255."))
                        goto emsgsize;
                m = SPRINTF((name, "%u.", net[n - 1]));
                name += m;
-               size -= m;
        }
 
        /* Add the static text. */
-       if (size < (int)(sizeof "in-addr.arpa"))
+       if (ep - name < (int)(sizeof "in-addr.arpa"))
                goto emsgsize;
        (void) SPRINTF((name, "in-addr.arpa"));
        return (0);



Home | Main Index | Thread Index | Old Index