Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GDB stub small fixes: out-of-bounds and wrong packet reply in 'qfThre…
…adInfo' (86Box#3666) * Fix out-of-bounds access on gdbstub_client_respond() The issue happens when the ENABLE_GDBSTUB_LOG flag is set, more specifically within the gdbstub_client_respond() function. This is due to the fact that the string 'GDB Stub: Sending response: ' and the newline character '\n' total 29 characters. When combined with the 995 characters of client->response, the total is 1024 bytes. However, the pclog_ex() buffer size is also 1024 bytes, leaving no room for the null terminator '\0'. As a result, when attempting to print the text on the screen, a segmentation fault occurs. This commit fixes this by decreasing the response text's size by one byte. * Remove extra space in 'qfThreadInfo' packet response in gdbstub.c When GDB sends the 'qfThreadInfo' packet, one of the possible responses is 'm thread-id', as specified in [1]. However, contrary to what the documentation implies, there is no space between 'm' and the thread-id. In the current approach, GDB isn't even able to recognize that there's any active thread, as the code sends "m 1" instead of "m1". This commit addresses this by removing the space in the response. Ref: [1]: https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html
- Loading branch information