diff --git a/src/init.c b/src/init.c index e1d1d46e..db336946 100644 --- a/src/init.c +++ b/src/init.c @@ -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 */ diff --git a/src/userfns.c b/src/userfns.c index 921360f7..a8a27788 100644 --- a/src/userfns.c +++ b/src/userfns.c @@ -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);