Use strndup when setting last_run_version

gConfigGeneral.last_run_version should have the string value copied to,
otherwise the SafeFree in config_set_property could try freeing value
from stack if used.
This commit is contained in:
Michał Janiszewski 2016-01-02 00:08:18 +01:00
parent 5b9a98a0f9
commit 17e5a0d356
1 changed files with 1 additions and 1 deletions

View File

@ -203,7 +203,7 @@ bool openrct2_initialise()
gOpenRCT2ShowChangelog = true;
if (gConfigGeneral.last_run_version != NULL && (strcmp(gConfigGeneral.last_run_version, OPENRCT2_VERSION) == 0))
gOpenRCT2ShowChangelog = false;
gConfigGeneral.last_run_version = OPENRCT2_VERSION;
gConfigGeneral.last_run_version = strndup(OPENRCT2_VERSION, strlen(OPENRCT2_VERSION));
config_save_default();
// TODO add configuration option to allow multiple instances