This is an automated email from Gerrit. Evgeniy Didin (di...@synopsys.com) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/5523
-- gerrit commit e9111f5b0e4ad57ecee530b856002808a7f3a977 Author: Evgeniy Didin <di...@synopsys.com> Date: Thu Mar 12 19:05:37 2020 +0300 target/arc_cmd: Improve argument checks for commands Add more arguments checks for "arc_set_reg_exists" and "add-reg" commands. Change-Id: Ia21e6baf4fbda162f7811cd0fe305fc86ddafcfd Signed-off-by: Evgeniy Didin <di...@synopsys.com> diff --git a/src/target/arc_cmd.c b/src/target/arc_cmd.c index 3475762..659b45c 100644 --- a/src/target/arc_cmd.c +++ b/src/target/arc_cmd.c @@ -679,12 +679,14 @@ static int jim_arc_add_reg(Jim_Interp *interp, int argc, Jim_Obj * const *argv) int e = ERROR_OK; /* At least we need to specify 4 parameters: name, number, type and gdb_feature, - * which means there should be 8 arguments */ - if (goi.argc < 8) { + * which means there should be 8 arguments. Also there can be additional paramters + * "-g" and "-core" or "-bcr" which makes maximum 10 parameters. */ + if (goi.argc < 8 || goi.argc > 10) { free_reg_desc(reg); Jim_SetResultFormatted(goi.interp, - "Should be at least 8 argnuments: -name <name> " - "-num <num> -type <type> -feature <gdb_feature>."); + "Should be at least 8 argnuments and not greater than 10: " + " -name <name> -num <num> -type <type> " + " -feature <gdb_feature> [-core|-bcr] [-g]."); return JIM_ERR; } @@ -824,6 +826,11 @@ COMMAND_HANDLER(arc_set_reg_exists) return ERROR_COMMAND_SYNTAX_ERROR; } + if (CMD_ARGC > 50) { + command_print(CMD, "The number of arguments exceeded maximum 50 elements"); + return ERROR_COMMAND_SYNTAX_ERROR; + } + for (unsigned int i = 0; i < CMD_ARGC; i++) { const char * const reg_name = CMD_ARGV[i]; struct reg * const r = arc_reg_get_by_name(target->reg_cache, reg_name, true); -- _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel