From 9cc9c56caddd5712c55c0705b8bddde0c908e45c Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 18 Jul 2021 11:19:51 +0200 Subject: [PATCH] Don't write past '\0', fixes a bug in commit 1c5e0d11d ("If there is a XSPICE code model .model line with file input, keep quotes and case for the file path.", 2021-07-15) --- src/frontend/inpcom.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 8736ef9ac..6f354881c 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -2664,6 +2664,8 @@ void inp_casefix(char *string) string++; if (*string) string++; // past second quote + if (*string == '\0') + break; } #endif if (*string == '"') { @@ -2675,7 +2677,7 @@ void inp_casefix(char *string) if (*string == '"') *string = ' '; } - if (!isspace_c(*string) && !isprint_c(*string)) + if (*string && !isspace_c(*string) && !isprint_c(*string)) *string = '_'; if (isupper_c(*string)) *string = tolower_c(*string);