Wireshark mailing list archives

OpenSafety bug - how to fix?


From: Chris Maynard <Chris.Maynard () gtech com>
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


___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe


Current thread: