Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

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

Date: Sat, 11 Feb 2012 07:12:35 GMT
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=40967

User: guy
Date: 2012/02/10 11:12 PM

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

Directory: /trunk/epan/dissectors/
  Changes    Path                  Action
  +5 -3      packet-ieee80211.c    Modified