From 058f474f907c79e20d072c2ef411cfb7efbf0690 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 20 Jan 2021 09:12:24 +0100 Subject: [PATCH] Prevent crash if netlist input is something like H n1 --- src/frontend/inpcom.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index f1b37406d..11161e781 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -9481,6 +9481,10 @@ static void inp_poly_2g6_compat(struct card* deck) { case 'e': curr_line = nexttok(curr_line); curr_line = nexttok(curr_line); + if (!curr_line) { + fprintf(stderr, "Error: not enough parameters in line\n %s\n", thisline); + controlled_exit(1); + } /* The next token may be a simple text token or an expression enclosed in brackets */ if (*curr_line == '{') { @@ -9499,6 +9503,10 @@ static void inp_poly_2g6_compat(struct card* deck) { case 'f': case 'h': curr_line = nexttok(curr_line); + if (!curr_line) { + fprintf(stderr, "Error: not enough parameters in line\n %s\n", thisline); + controlled_exit(1); + } /* The next token may be a simple text token or an expression enclosed in brackets */ if (*curr_line == '{') {