1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-17 12:03:07 +01:00

Prevent variable underflow in path_end_with_separator

This commit is contained in:
Michał Janiszewski
2016-11-22 17:15:03 +01:00
committed by GitHub
parent 349ca774ca
commit 2ec1fd0378

View File

@@ -146,7 +146,7 @@ void path_end_with_separator(utf8 *path, size_t size) {
size_t length = strnlen(path, size);
if (length >= size - 1) return;
if (path[length - 1] != *PATH_SEPARATOR)
if ((length == 0) || (path[length - 1] != *PATH_SEPARATOR))
safe_strcat(path, PATH_SEPARATOR, size);
}