mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 03:53:07 +01:00
Only copy strings when they're different
When called from window_loadsave_scrollmousedown, window_loadsave_populate_list will try to strncpy a string over itself. This commit prevents that.
This commit is contained in:
@@ -600,7 +600,9 @@ static void window_loadsave_populate_list(int includeNewItem, bool browsable, co
|
||||
char *dst, filter[MAX_PATH], subDir[MAX_PATH];
|
||||
|
||||
strncpy(_directory, directory, sizeof(_directory));
|
||||
strncpy(_extension, extension, sizeof(_extension));
|
||||
if (_extension != extension) {
|
||||
strncpy(_extension, extension, sizeof(_extension));
|
||||
}
|
||||
_shortenedDirectory[0] = '\0';
|
||||
|
||||
strncpy(filter, directory, sizeof(filter));
|
||||
|
||||
Reference in New Issue
Block a user