inpcom.c: avoid segfault when `TABLE' is used without parentheses

This commit is contained in:
Krzysztof Blaszkowski 2013-10-13 22:41:49 +02:00 committed by rlar
parent bf9551287e
commit 23cdd5e53f
1 changed files with 5 additions and 0 deletions

View File

@ -4369,6 +4369,11 @@ inp_compat(struct line *card)
secondno = gettok_node(&cut_line);
midline = cut_line;
cut_line = strrchr(str_ptr, '(');
if (!cut_line) {
fprintf(stderr, "Error: bad syntax in line %d (missing parentheses)\n %s\n",
card->li_linenum_orig, card->li_line);
controlled_exit(EXIT_BAD);
}
/* replace '(' with ',' and ')' with ' ' */
for (; *str_ptr; str_ptr++)
if (*str_ptr == '(')