From 4f28e846328cbaaed8c3e9e941d06a50512e0ddf Mon Sep 17 00:00:00 2001 From: Scott Knight <4534275+knightsc@users.noreply.github.com> Date: Tue, 27 Nov 2018 17:30:18 -0500 Subject: [PATCH] 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. --- src/gba/remote.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gba/remote.cpp b/src/gba/remote.cpp index 5679ac00..ca6e3a28 100644 --- a/src/gba/remote.cpp +++ b/src/gba/remote.cpp @@ -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;