From 01e8b4da84000baf27e9bd05fc7197c637b49f2f Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 3 Jun 2023 17:09:10 +0200 Subject: [PATCH] Prevent crash upon buggy user input (missing ] or >) --- src/frontend/inpcom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 1137a36b3..aa9305c1d 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -4558,7 +4558,7 @@ static void inp_fix_param_values(struct card *c) brackets around all params inside a pair of square brackets */ end_of_str = beg_of_str; - while (*end_of_str != ']') + while (*end_of_str != ']' && *end_of_str != '\0') end_of_str++; /* string xx yyy from vector [xx yyy] */ tmp_str = vec_str = @@ -4634,7 +4634,7 @@ static void inp_fix_param_values(struct card *c) /* A complex value following the '=' token: code to put curly brackets around all params inside a pair < > */ end_of_str = beg_of_str; - while (*end_of_str != '>') + while (*end_of_str != '>' && *end_of_str != '\0') end_of_str++; /* string xx yyy from vector [xx yyy] */ vec_str = copy_substring(beg_of_str + 1, end_of_str);