mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
Fix segfault on 'rem <verylongline>'
This commit is contained in:
@@ -149,6 +149,7 @@ int CLIParserParseStringEx(CLIParserContext *ctx, const char *str, void *vargtab
|
||||
int len = strlen(str);
|
||||
memset(ctx->buf, 0x00, ARRAYLEN(ctx->buf));
|
||||
char *bufptr = ctx->buf;
|
||||
char *bufptrend = ctx->buf + ARRAYLEN(ctx->buf) - 1;
|
||||
char *spaceptr = NULL;
|
||||
enum ParserState state = PS_FIRST;
|
||||
|
||||
@@ -198,6 +199,11 @@ int CLIParserParseStringEx(CLIParserContext *ctx, const char *str, void *vargtab
|
||||
bufptr++;
|
||||
break;
|
||||
}
|
||||
if (bufptr > bufptrend) {
|
||||
PrintAndLogEx(ERR, "ERROR: Line too long\n");
|
||||
fflush(stdout);
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
return CLIParserParseArg(ctx, argc, argv, vargtable, vargtableLen, allowEmptyExec);
|
||||
|
||||
Reference in New Issue
Block a user