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 committed 2016-01-02 00:11:34 +01:00
1 parent 5b9a98a0f9
commit 17e5a0d356
1 file changed
+1 -1
+1 -1
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