Wireshark-commits: [Wireshark-commits] rev 45459: /trunk/epan/dissectors/ /trunk/epan/dissectors/:

Date: Thu, 11 Oct 2012 00:02:15 GMT
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=45459

User: guy
Date: 2012/10/10 05:02 PM

Log:
 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.

Directory: /trunk/epan/dissectors/
  Changes    Path               Action
  +1 -1      packet-icmpv6.c    Modified