Wireshark-dev: Re: [Wireshark-dev] OpenSafety bug - how to fix?

From: Roland Knall <rknall@xxxxxxxxx>
Date: Tue, 20 Sep 2011 18:29:20 +0200
The fix is correct. Are there any other Coverty hits for openSafety,
or just the one?

Regards, Roland



Am 20.09.2011 um 15:53 schrieb Chris Maynard <Chris.Maynard@xxxxxxxxx>:

> 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@xxxxxxxxxxxxx>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe