mirror of
https://github.com/pygos/init.git
synced 2024-11-22 11:19:45 +01:00
Only parse arguments if index actually is numeric
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
This commit is contained in:
parent
24e98f1e5b
commit
b3773d09ea
1 changed files with 7 additions and 6 deletions
|
@ -84,15 +84,16 @@ static int normalize_line(rdline_t *t)
|
||||||
} else if (c == '%') {
|
} else if (c == '%') {
|
||||||
*(dst++) = c;
|
*(dst++) = c;
|
||||||
c = *(src++);
|
c = *(src++);
|
||||||
if (c != '%' && !isdigit(c)) {
|
if (isdigit(c)) {
|
||||||
errstr = "expected digit after '%%'";
|
if ((c - '0') >= t->argc) {
|
||||||
goto fail;
|
|
||||||
}
|
|
||||||
if (isdigit(c) && (c - '0') >= t->argc) {
|
|
||||||
errstr = "argument out of range";
|
errstr = "argument out of range";
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
ret += strlen(t->argv[c - '0']);
|
ret += strlen(t->argv[c - '0']);
|
||||||
|
} else if (c != '%') {
|
||||||
|
errstr = "expected digit after '%%'";
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
} else if (string && c == '\\' && *src != '\0') {
|
} else if (string && c == '\\' && *src != '\0') {
|
||||||
*(dst++) = c;
|
*(dst++) = c;
|
||||||
c = *(src++);
|
c = *(src++);
|
||||||
|
|
Loading…
Reference in a new issue