mirror of
https://github.com/pygos/init.git
synced 2024-12-22 07:10:49 +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 == '%') {
|
||||
*(dst++) = c;
|
||||
c = *(src++);
|
||||
if (c != '%' && !isdigit(c)) {
|
||||
if (isdigit(c)) {
|
||||
if ((c - '0') >= t->argc) {
|
||||
errstr = "argument out of range";
|
||||
goto fail;
|
||||
}
|
||||
ret += strlen(t->argv[c - '0']);
|
||||
} else if (c != '%') {
|
||||
errstr = "expected digit after '%%'";
|
||||
goto fail;
|
||||
}
|
||||
if (isdigit(c) && (c - '0') >= t->argc) {
|
||||
errstr = "argument out of range";
|
||||
goto fail;
|
||||
}
|
||||
ret += strlen(t->argv[c - '0']);
|
||||
} else if (string && c == '\\' && *src != '\0') {
|
||||
*(dst++) = c;
|
||||
c = *(src++);
|
||||
|
|
Loading…
Reference in a new issue