Fix stack overflow in remotePutPacket

If the packet passed into remotePutPacket was 1024 bytes or
larger then the buffer array would not be large enough to hold
the $, checksum and zero byte written. This now allocates a buffer
of size count + 5 to accommodate these extra characters.
This commit is contained in:
Scott Knight 2018-11-27 17:30:18 -05:00
parent db8aaeca87
commit 4f28e84632
No known key found for this signature in database
GPG Key ID: 8D2E42E6C5F4A267
1 changed files with 1 additions and 1 deletions

View File

@ -3526,9 +3526,9 @@ void remoteInit()
void remotePutPacket(const char* packet)
{
const char* hex = "0123456789abcdef";
char buffer[1024];
size_t count = strlen(packet);
char buffer[count + 5];
unsigned char csum = 0;