Source-Changes-HG archive

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

[src/trunk]: src Don't use array access to compute addresses that are definit...



details:   https://anonhg.NetBSD.org/src/rev/6d85a19a3b52
branches:  trunk
changeset: 768134:6d85a19a3b52
user:      joerg <joerg%NetBSD.org@localhost>
date:      Tue Aug 09 12:55:18 2011 +0000

description:
Don't use array access to compute addresses that are definitely beyond
the static array boundaries.

diffstat:

 external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c |  2 +-
 sbin/ping/ping.c                                         |  8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (41 lines):

diff -r ed52ec33e7df -r 6d85a19a3b52 external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c
--- a/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c  Tue Aug 09 12:30:46 2011 +0000
+++ b/external/apache2/mDNSResponder/dist/mDNSCore/DNSCommon.c  Tue Aug 09 12:55:18 2011 +0000
@@ -2635,7 +2635,7 @@
                case kDNSType_OPT:      {
                                                        rdataOPT *opt = rr->resrec.rdata->u.opt;
                                                        rr->resrec.rdlength = 0;
-                                                       while (ptr < end && (mDNSu8 *)(opt+1) < &rr->resrec.rdata->u.data[MaximumRDSize])
+                                                       while (ptr < end && (mDNSu8 *)(opt+1) < rr->resrec.rdata->u.data + MaximumRDSize)
                                                                {
                                                                if (ptr + 4 > end) { LogMsg("GetLargeResourceRecord: OPT RDATA ptr + 4 > end"); return(mDNSNULL); }
                                                                opt->opt    = getVal16(&ptr);
diff -r ed52ec33e7df -r 6d85a19a3b52 sbin/ping/ping.c
--- a/sbin/ping/ping.c  Tue Aug 09 12:30:46 2011 +0000
+++ b/sbin/ping/ping.c  Tue Aug 09 12:55:18 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ping.c,v 1.93 2011/03/11 09:59:56 pooka Exp $  */
+/*     $NetBSD: ping.c,v 1.94 2011/08/09 12:55:19 joerg Exp $  */
 
 /*
  * Copyright (c) 1989, 1993
@@ -58,7 +58,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping.c,v 1.93 2011/03/11 09:59:56 pooka Exp $");
+__RCSID("$NetBSD: ping.c,v 1.94 2011/08/09 12:55:19 joerg Exp $");
 #endif
 
 #include <stdio.h>
@@ -1069,8 +1069,8 @@
                /* check the data */
                if (datalen > (int)PHDR_LEN
                    && !(pingflags & F_PING_RANDOM)
-                   && memcmp(&icp->icmp_data[PHDR_LEN],
-                           &opack_icmp.icmp_data[PHDR_LEN],
+                   && memcmp(icp->icmp_data + PHDR_LEN,
+                           opack_icmp.icmp_data + PHDR_LEN,
                            datalen-PHDR_LEN)) {
                        for (i=PHDR_LEN; i<datalen; i++) {
                                if (icp->icmp_data[i] !=



Home | Main Index | Thread Index | Old Index