aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-04-12 09:14:34 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-04-12 09:14:34 -0400
commit35ffcc51dd4ba254793505b5eebbdba8fd7aefc8 (patch)
tree1413f59472e464768a104265dacb227002f5650b /src
parent3ce1a45a324b83b1c8b02d3799fe15f7a817c57d (diff)
downloadstasis-35ffcc51dd4ba254793505b5eebbdba8fd7aefc8.tar.gz
Fix invalid read on operator
* If no data exists beyond the operator, set the value to an empty string
Diffstat (limited to 'src')
-rw-r--r--src/ini.c6
1 files changed, 5 insertions, 1 deletions
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;