trace: fix pointer cross the border
Fix pointer cross the border
@@ -485,6 +485,8 @@ static int trace_cmd_switch(int index, int argc, FAR char **argv,
/* Parse the setting parameters */
+ if (index < argc)
+ {
if (argv[index][0] == '-' || argv[index][0] == '+')
{
enable = (argv[index][0] == '+');
@@ -509,6 +511,7 @@ static int trace_cmd_switch(int index, int argc, FAR char **argv,
index++;
}
+ }
return index;
}
@@ -735,6 +738,8 @@ static int trace_cmd_print(int index, int argc, FAR char **argv,
/* Parse the setting parameters */
+ if (index < argc)
+ {
if (argv[index][0] == '-' || argv[index][0] == '+')
{
enable = (argv[index][0] == '+');
@@ -759,6 +764,7 @@ static int trace_cmd_print(int index, int argc, FAR char **argv,
index++;
}
+ }
return index;
}
