Don't use 16-bit integers as counters. The code won't be any faster on
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 11 Feb 2012 07:12:34 +0000 (07:12 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 11 Feb 2012 07:12:34 +0000 (07:12 +0000)
commita56cb6d9327b2a67e7786ce7fb9322054ff40b70
tree87f700d9f60fd4b7f840db5abff0edf08cd0980b
parente00ccced1777b844705d74c6a8ca380c33e9c5a8
Don't use 16-bit integers as counters.  The code won't be any faster on
anything that can run Wireshark (it might be slower), and if the maximum
count value is 16-bit, you can loop forever if the maximum count value
happens to be 65535.

(Yes, this means that

guint i, j;

...

for (i = 0; i < j; i++)
...

risks looping forever if j is 2^32-1, and the same applies to 64-bit
counters.  There are probably fewer protocols with 32-bit counts, and
probably even fewer with 64-bit counts, but the way it should be done in
those cases, for safety, is

i = 0;
for (;;) {
if (i >= j)
break;

...

if (i == j - 1)
break;
}

or something such as that.)

Fixes bug 6809.

#BACKPORT
Will schedule for 1.6.x.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@40967 f5534014-38df-0310-8fa8-9805f1628bb7
epan/dissectors/packet-ieee80211.c