Source-Changes-HG archive

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

[src/netbsd-7]: src/sbin/ping6 Pull up following revision(s) (requested by ch...



details:   https://anonhg.NetBSD.org/src/rev/adeb09194f4a
branches:  netbsd-7
changeset: 798954:adeb09194f4a
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Feb 04 22:05:29 2015 +0000

description:
Pull up following revision(s) (requested by chs in ticket #493):
        sbin/ping6/ping6.c: revision 1.83
Rework to avoid a conditional assignment which results in a
"maybe-uninitialized" warning

diffstat:

 sbin/ping6/ping6.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (56 lines):

diff -r d9977613addf -r adeb09194f4a sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Wed Feb 04 22:00:24 2015 +0000
+++ b/sbin/ping6/ping6.c        Wed Feb 04 22:05:29 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ping6.c,v 1.82 2013/10/19 01:09:16 christos Exp $      */
+/*     $NetBSD: ping6.c,v 1.82.4.1 2015/02/04 22:05:29 martin Exp $    */
 /*     $KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $ */
 
 /*
@@ -77,7 +77,7 @@
 #else
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: ping6.c,v 1.82 2013/10/19 01:09:16 christos Exp $");
+__RCSID("$NetBSD: ping6.c,v 1.82.4.1 2015/02/04 22:05:29 martin Exp $");
 #endif
 #endif
 
@@ -125,6 +125,7 @@
 #include <fcntl.h>
 #include <math.h>
 #include <signal.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -1844,6 +1845,7 @@
        }
 
        while (cp < end) {
+               size_t skip = 0;
                clen = (size_t)(end - cp);
                if ((ni->ni_flags & NI_SUPTYPE_FLAG_COMPRESS) == 0) {
                        if (clen == 0 || clen > MAXQTYPES / 8 ||
@@ -1860,8 +1862,8 @@
                                return;
                        cp += sizeof(cbit);
                        clen = ntohs(cbit.words) * sizeof(v);
-                       if (cur + clen * 8 + (u_long)ntohs(cbit.skip) * 32 >
-                           MAXQTYPES)
+                       skip = (size_t)ntohs(cbit.skip) * 32;
+                       if (cur + clen * 8 + skip > MAXQTYPES)
                                return;
                }
 
@@ -1874,9 +1876,7 @@
                b = pr_bitrange(0, (int)(cur + off * 8), b);
 
                cp += clen;
-               cur += clen * 8;
-               if ((ni->ni_flags & NI_SUPTYPE_FLAG_COMPRESS) != 0)
-                       cur += ntohs(cbit.skip) * 32;
+               cur += clen * 8 + skip;
        }
 }
 



Home | Main Index | Thread Index | Old Index