Debugger: Reject traces with negative trace amounts (fixes #2900)

This commit is contained in:
Vicki Pfau 2023-04-26 00:48:12 -07:00
parent 3a59d9cb83
commit 622c2491b9
1 changed files with 5 additions and 1 deletions

View File

@ -809,10 +809,14 @@ static void _listWatchpoints(struct CLIDebugger* debugger, struct CLIDebugVector
}
static void _trace(struct CLIDebugger* debugger, struct CLIDebugVector* dv) {
if (!dv || dv->type != CLIDV_INT_TYPE) {
if (!dv) {
debugger->backend->printf(debugger->backend, "%s\n", ERROR_MISSING_ARGS);
return;
}
if (dv->type != CLIDV_INT_TYPE || dv->intValue < 0) {
debugger->backend->printf(debugger->backend, "%s\n", ERROR_INVALID_ARGS);
return;
}
debugger->traceRemaining = dv->intValue;
if (debugger->traceVf) {