Ethereal-dev: [Ethereal-dev] Re: BACnet packet-bacapp corrections

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Steve Karg <skarg@xxxxxxxxxxxxxxxxxxxxx>
Date: Sat, 15 Apr 2006 18:52:45 -0400
Hi Jaap,

Doesn't this snippet

-       switch (lvt) {
 .....
-               case 8:
-                       *val = tvb_get_ntoh64(tvb, offset);
-                       break;
+       if (lvt < 8) {

show that you no longer handle the lvt == 8 case?

Yes - you are right, the Unsigned decode function should read:
> +       if (lvt <= 8) {

The same can be said for the Signed portion which should read:
> +       if (lvt <= 7) {

Thanks for catching that! Another patch is attached to replace the first one.

Patch summary:

1) BACnet signed values were being decoded incorrectly for negative values since BACnet tries to be clever and minimizes the number of bytes sent on the wire and drops the leading FF on negative values. For example, -200 is passed as FF 38 on the wire, but would display as 65336.

2) Since the BACnet unsigned values were decoded using a 64-bit entity, I changed the decoding such that allows all 8 bytes to be decoded. The function can now decode 5, 6, and 7 byte values.

3) Corrected warning about signed/unsigned in a pointer parameter.

Best Regards,

Steve

Attachment: bacapp.patch.gz
Description: GNU Zip compressed data