-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I found that line 79 contains a bug.
79 if (*(plget->data + MAC_ADDR_SIZE * 2) == 0x81 &&
In this case as plget->data is a char type, which is a signed type, at 0x81 is a literal with the MSB or sign bit set, the compiler converts 0x81 to 0xffffff81 (sort of reinterpreted modulo 128). this means the condition returns false when it should return true.
Proper fix is not to use a signed type for raw data, use unsigned char rather than char.
Alternatively, type cast all numeric literals (certainly the ones that have a their MSB set) to char.
79 if (*(plget->data + MAC_ADDR_SIZE * 2) == (char)0x81 &&
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels