diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-12 09:14:34 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-04-12 09:14:34 -0400 |
commit | 35ffcc51dd4ba254793505b5eebbdba8fd7aefc8 (patch) | |
tree | 1413f59472e464768a104265dacb227002f5650b /src | |
parent | 3ce1a45a324b83b1c8b02d3799fe15f7a817c57d (diff) | |
download | stasis-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.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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; |