From 23cdd5e53fe015a0bb02a20c71da37674c6432ac Mon Sep 17 00:00:00 2001 From: Krzysztof Blaszkowski Date: Sun, 13 Oct 2013 22:41:49 +0200 Subject: [PATCH] inpcom.c: avoid segfault when `TABLE' is used without parentheses --- src/frontend/inpcom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 1df65d6eb..054cdb7c1 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -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 == '(')