Skip to content

Conversation

@pdbogen
Copy link

@pdbogen pdbogen commented Jul 1, 2016

There are flaws in the library's handling of packet transmission and reception that result in buffer overflows and memory corruption. I'm fairly certain these are specifically due to the use of short uint8_t arrays to send and receive packets; where the arrays are based on the sent packet payload without regard to the length of the respond payload. There are even compiler warnings about this.

My fix is to utilize a single struct that encompasses all the fields of the packet, and names them. I'm currently using a fixed body of 64 bytes, which may be excessive; but I don't know the protocol well enough to know what the largest actual packet size would be.

This works for my use case, seems reliable, and does not exhibit the system-breaking behavior of the existing library's overflows.

  • Scope: All command functions.
  • Limitations: None known.
  • Examples: I'm using the main functionality of the device in my own code but I haven't tested with the examples. I'll try this out tomorrow.

ladyada added a commit that referenced this pull request Nov 25, 2017
@ladyada
Copy link
Member

ladyada commented Nov 25, 2017

yay rad! hand-merged

@ladyada ladyada closed this Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants