summaryrefslogtreecommitdiff
path: root/src/core/gdbstub/gdbstub.cpp
diff options
context:
space:
mode:
authorGravatar polaris-2015-10-21 06:49:49 -0400
committerGravatar polaris-2015-10-21 06:49:49 -0400
commit9f66580d7e353b96690690f776d557f1c9028b37 (patch)
tree2196a86ec55d766794ee2fa710fd698f1a53eed4 /src/core/gdbstub/gdbstub.cpp
parentRemove unnecessary new lines, changed Deinit to Shutdown (diff)
downloadyuzu-9f66580d7e353b96690690f776d557f1c9028b37.tar.gz
yuzu-9f66580d7e353b96690690f776d557f1c9028b37.tar.xz
yuzu-9f66580d7e353b96690690f776d557f1c9028b37.zip
Fix buffer overflow comments
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
-rw-r--r--src/core/gdbstub/gdbstub.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 15e6f36a0..0d586ca10 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -306,6 +306,7 @@ static void SendReply(const char* reply) {
306 command_length = strlen(reply); 306 command_length = strlen(reply);
307 if (command_length + 4 > sizeof(command_buffer)) { 307 if (command_length + 4 > sizeof(command_buffer)) {
308 LOG_ERROR(Debug_GDBStub, "command_buffer overflow in SendReply"); 308 LOG_ERROR(Debug_GDBStub, "command_buffer overflow in SendReply");
309 return;
309 } 310 }
310 311
311 memcpy(command_buffer + 1, reply, command_length); 312 memcpy(command_buffer + 1, reply, command_length);
@@ -403,12 +404,12 @@ static void ReadCommand() {
403 } 404 }
404 405
405 while ((c = ReadByte()) != GDB_STUB_END) { 406 while ((c = ReadByte()) != GDB_STUB_END) {
406 command_buffer[command_length++] = c; 407 if (command_length >= sizeof(command_buffer)) {
407 if (command_length == sizeof(command_buffer)) {
408 LOG_ERROR(Debug_GDBStub, "gdb: command_buffer overflow\n"); 408 LOG_ERROR(Debug_GDBStub, "gdb: command_buffer overflow\n");
409 SendPacket(GDB_STUB_NACK); 409 SendPacket(GDB_STUB_NACK);
410 return; 410 return;
411 } 411 }
412 command_buffer[command_length++] = c;
412 } 413 }
413 414
414 u8 checksum_received = HexCharToValue(ReadByte()) << 4; 415 u8 checksum_received = HexCharToValue(ReadByte()) << 4;