Module Name: src
Committed By: martin
Date: Wed Feb 4 22:05:30 UTC 2015
Modified Files:
src/sbin/ping6 [netbsd-7]: ping6.c
Log Message:
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
To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.82.4.1 src/sbin/ping6/ping6.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.82 src/sbin/ping6/ping6.c:1.82.4.1
--- src/sbin/ping6/ping6.c:1.82 Sat Oct 19 01:09:16 2013
+++ src/sbin/ping6/ping6.c Wed Feb 4 22:05:29 2015
@@ -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 @@ static char sccsid[] = "@(#)ping.c 8.1 (
#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 @@ __RCSID("$NetBSD: ping6.c,v 1.82 2013/10
#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 @@ pr_suptypes(struct icmp6_nodeinfo *ni /*
}
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 @@ pr_suptypes(struct icmp6_nodeinfo *ni /*
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 @@ pr_suptypes(struct icmp6_nodeinfo *ni /*
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;
}
}