diff --git a/src/filesystem/windows/SDL_sysfilesystem.c b/src/filesystem/windows/SDL_sysfilesystem.c index 5e223d7cc..a2e213212 100644 --- a/src/filesystem/windows/SDL_sysfilesystem.c +++ b/src/filesystem/windows/SDL_sysfilesystem.c @@ -68,7 +68,9 @@ SDL_GetBasePath(void) path = (WCHAR *) ptr; len = pGetModuleFileNameExW(GetCurrentProcess(), NULL, path, buflen); - if (len != buflen) { + /* if it truncated, then len >= buflen - 1 */ + /* if there was enough room (or failure), len < buflen - 1 */ + if (len < buflen - 1) { break; }