aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-icmpv6.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-10-11 00:02:14 +0000
committerGuy Harris <guy@alum.mit.edu>2012-10-11 00:02:14 +0000
commitf154882eb531f5e19093e946faf92c57e140d2be (patch)
treefb06895bed244ba6ab0190297513bf30d1ee89ef /epan/dissectors/packet-icmpv6.c
parent6f112aa1159573aab234c7175dcb07a85f1f3b49 (diff)
The usual idiom in C for "do this N times" is "for (i = 0; i < N; i++)",
not "for (i = 1; i < N+1; i++)". Even if it weren't the idiom, it'd be safer, at least for unsigned values, as, if i and N are the same width, and N has the maximum possible value for that width, the first of those runs i from 0 to N-1, all of which fit in a variable of that width, and the second of those runs i from 1 to N, the latter of which doesn't fit into a variable of that width, so modulo arithmetic turns it into 0 and the loop keeps running forever. Fixes bug 7844. svn path=/trunk/; revision=45459
Diffstat (limited to 'epan/dissectors/packet-icmpv6.c')
-rw-r--r--epan/dissectors/packet-icmpv6.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dissectors/packet-icmpv6.c b/epan/dissectors/packet-icmpv6.c
index 2f84271ed3..a1f4ebac73 100644
--- a/epan/dissectors/packet-icmpv6.c
+++ b/epan/dissectors/packet-icmpv6.c
@@ -3426,7 +3426,7 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
offset += 2;
/* Source Address */
- for (i=1; i <= nb_sources; i++){
+ for (i=0; i < nb_sources; i++){
proto_tree_add_item(icmp6_tree, hf_icmpv6_mld_source_address, tvb, offset, 16, ENC_NA);
offset += 16;
}