mirror of https://github.com/mgba-emu/mgba.git
Debugger: Fix buffer overflow in _doTrace (#2361)
This commit is contained in:
parent
aceb1dff97
commit
dea26b756a
|
@ -744,7 +744,7 @@ static bool _doTrace(struct CLIDebugger* debugger) {
|
||||||
trace[sizeof(trace) - 1] = '\0';
|
trace[sizeof(trace) - 1] = '\0';
|
||||||
size_t traceSize = sizeof(trace) - 2;
|
size_t traceSize = sizeof(trace) - 2;
|
||||||
debugger->d.platform->trace(debugger->d.platform, trace, &traceSize);
|
debugger->d.platform->trace(debugger->d.platform, trace, &traceSize);
|
||||||
if (traceSize + 1 <= sizeof(trace)) {
|
if (traceSize + 2 <= sizeof(trace)) {
|
||||||
trace[traceSize] = '\n';
|
trace[traceSize] = '\n';
|
||||||
trace[traceSize + 1] = '\0';
|
trace[traceSize + 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue