Wireshark-dev: [Wireshark-dev] OpenSafety bug - how to fix?
From: Chris Maynard <Chris.Maynard@xxxxxxxxx>
Date: Tue, 20 Sep 2011 13:52:15 +0000 (UTC)
Coverity reports the following in CID 1204 against the OpenSafety dissector:

1466 	        firstByte = ( tvb_get_guint8(message_tvb, 0) << 1 );
Event missing_parentheses: !firstByte & 0x40 is always 0 regardless of the
values of its operands (non-specific value). Did you intend to apply '&' to
firstByte and 64? If so, parentheses would be required to force this 
interpretation.
1467 	        if ( ( (!firstByte) & 0x40 ) != 0x40 )
1468 	        {
1469 	        	result = 
opensafety_package_dissector("openSAFETY/SercosIII", "sercosiii",
1470 	        			FALSE, FALSE, message_tvb, pinfo, tree);
1471 	        }

So, should line 1467 read something like this instead?:

1467 	        if ( !((firstByte & 0x40) == 0x40) )

Can someone with knowledge of the OpenSafety dissector confirm if this is the
right fix?

- Chris