fix system fatal error caused by imperfect user input commands, e.g. "rtl sym -u"

This commit is contained in:
shuhua huang
2024-08-02 05:54:12 +00:00
parent 30ae3ef9da
commit a0eecb52bc

View File

@@ -265,7 +265,7 @@ rtems_rtl_parse_arg_index (const char opt,
/*
* Is this an option and does it match what we are looking for?
*/
if (argv[arg][0] == '-' && argv[arg][1] == opt && arg < argc)
if (arg < argc && argv[arg][0] == '-' && argv[arg][1] == opt)
return arg + 1;
}
return -1;