From 35ffcc51dd4ba254793505b5eebbdba8fd7aefc8 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Fri, 12 Apr 2024 09:14:34 -0400 Subject: Fix invalid read on operator * If no data exists beyond the operator, set the value to an empty string --- src/ini.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/ini.c') diff --git a/src/ini.c b/src/ini.c index f43beaa..8b50b31 100644 --- a/src/ini.c +++ b/src/ini.c @@ -401,7 +401,11 @@ struct INIFILE *ini_open(const char *filename) { memset(key_last, 0, sizeof(inikey[1])); strcpy(key_last, key); reading_value = 1; - strcpy(value, &operator[1]); + if (strlen(operator) > 1) { + strcpy(value, &operator[1]); + } else { + strcpy(value, ""); + } if (isempty(value)) { //printf("%s is probably long raw data\n", key); multiline_data = 1; -- cgit