Fix segfault on 'rem <verylongline>'
This commit is contained in:
1 parent
5eda1ea400
commit
8ce20320b2
1 file changed
+6
@@ -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