diff options
author | frosch <frosch@openttd.org> | 2014-01-02 17:55:57 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2014-01-02 17:55:57 +0000 |
commit | 7247ecf172e85ed47b13ccb9aa1ffcc2050b0114 (patch) | |
tree | 5a7f13604c5e3181b631845f0637680ed5ab9ad8 /src/ini_load.cpp | |
parent | 3c94485ba0dcf8bb26f94f3a8e74369cd5619c01 (diff) | |
download | openttd-7247ecf172e85ed47b13ccb9aa1ffcc2050b0114.tar.xz |
(svn r26206) -Fix [FS#5829]: Run everything from ini, obg, obs, obs, ... files through str_validate.
Diffstat (limited to 'src/ini_load.cpp')
-rw-r--r-- | src/ini_load.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ini_load.cpp b/src/ini_load.cpp index 6a2087303..158ffa6a7 100644 --- a/src/ini_load.cpp +++ b/src/ini_load.cpp @@ -26,6 +26,8 @@ IniItem::IniItem(IniGroup *parent, const char *name, size_t len) : next(NULL), v if (len == 0) len = strlen(name); this->name = strndup(name, len); + if (this->name != NULL) str_validate(this->name, this->name + len); + *parent->last_item = this; parent->last_item = &this->next; } @@ -61,6 +63,8 @@ IniGroup::IniGroup(IniLoadFile *parent, const char *name, size_t len) : next(NUL if (len == 0) len = strlen(name); this->name = strndup(name, len); + if (this->name != NULL) str_validate(this->name, this->name + len); + this->last_item = &this->item; *parent->last_group = this; parent->last_group = &this->next; @@ -305,6 +309,7 @@ void IniLoadFile::LoadFromDisk(const char *filename, Subdirectory subdir) /* If the value was not quoted and empty, it must be NULL */ item->value = (!quoted && e == t) ? NULL : strndup(t, e - t); + if (item->value != NULL) str_validate(item->value, item->value + strlen(item->value)); } else { /* it's an orphan item */ this->ReportFileError("ini: '", buffer, "' outside of group"); |