diff --git a/files/dos_fs.c b/files/dos_fs.c index 95414528e4b..0919d0306c5 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -1058,8 +1058,14 @@ DWORD WINAPI GetFullPathName32A( LPCSTR name, DWORD len, LPSTR buffer, if (ret && lastpart) { LPSTR p = buffer + strlen(buffer); - while ((p > buffer + 2) && (*p != '\\')) p--; - *lastpart = p + 1; + + /* if the path closed with '\', *lastpart is 0 */ + if (*p != '\\') + { + while ((p > buffer + 2) && (*p != '\\')) p--; + *lastpart = p + 1; + } + else *lastpart = NULL; } return ret; }