W32: check filename for being NULL in g_stat()

Previous version of this function started with a call to g_utf8_to_utf16(),
which also served as a NULL check, since g_utf8_to_utf16() just returns NULL
on NULL strings. Current version of this function does some filename string
checks first and converts it to utf16 only after these checks are done, and
these checks do not take into account the possibility of filename being NULL.

Fix this by explicitly checking for NULL.
This commit is contained in:
Руслан Ижбулатов
2018-05-22 16:43:35 +00:00
parent 4c364635ed
commit 0bc1e98af6

View File

@@ -365,6 +365,12 @@ _g_win32_stat_utf8 (const gchar *filename,
int result;
gsize len;
if (filename == NULL)
{
errno = EINVAL;
return -1;
}
len = strlen (filename);
while (len > 0 && G_IS_DIR_SEPARATOR (filename[len - 1]))