From 17e5a0d356f267a6646bb6294b056dc6497f8f4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Sat, 2 Jan 2016 00:08:18 +0100 Subject: [PATCH] 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. --- src/openrct2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openrct2.c b/src/openrct2.c index eb41a4457f..469a610c29 100644 --- a/src/openrct2.c +++ b/src/openrct2.c @@ -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