The `parse_args(...)` function writes to the `argv` array in 2
locations but was only bounds checking in one of them.
Moved the bounds check so that it is encountered on each iteration
through the parsing loop.
Resolves: #2069
+ if (x >= MAX_ARGS - 1) {
+ ast_log(LOG_WARNING, "Too many arguments, truncating\n");
+ x = MAX_ARGS - 1;
+ break;
+ }
+
switch(*s) {
case '"':
/* If it's escaped, put a literal quote */
switch(*s) {
case '"':
/* If it's escaped, put a literal quote */
default:
normal:
if (whitespace) {
default:
normal:
if (whitespace) {
- if (x >= MAX_ARGS -1) {
- ast_log(LOG_WARNING, "Too many arguments, truncating\n");
- break;
- }
/* Coming off of whitespace, start the next argument */
argv[x++] = cur;
whitespace=0;
/* Coming off of whitespace, start the next argument */
argv[x++] = cur;
whitespace=0;