Skip to content

Bug in tx_lat.c #1

@JMLCarter

Description

@JMLCarter

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 &&

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions