Stricter parsing of '-i' option.

This commit is contained in:
Dianne Skoll
2024-05-25 09:36:33 -04:00
parent 9c3f0f1994
commit 959355b19c
2 changed files with 13 additions and 1 deletions

View File

@@ -926,7 +926,12 @@ static void InitializeVar(char const *str)
r = 0;
while (*str && *str != '=') {
if (r < VAR_NAME_LEN) {
varname[r++] = *str;
if (isalpha(*str) || *str == '_' || (r > 0 && *str == '(') || (r == 0 && *str == '$') || (r > 0 && isdigit(*str))) {
varname[r++] = *str;
} else {
fprintf(ErrFp, ErrMsg[M_I_OPTION], ErrMsg[E_ILLEGAL_CHAR]);
return;
}
}
if (*str == '(') {
/* Do a function definition if we see a paren */

View File

@@ -201,6 +201,13 @@ int DoFset(ParsePtr p)
return E_PARSE_ERR;
}
while(*(p->pos) && isspace(*(p->pos))) {
p->pos++;
}
if (!*(p->pos)) {
DestroyUserFunc(func);
return E_EOLN;
}
func->text = StrDup(p->pos);
if (!func->text) {
DestroyUserFunc(func);