mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-25 19:52:10 +01:00
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:
parent
2e3769a4f7
commit
52c45a102b
@ -365,6 +365,12 @@ _g_win32_stat_utf8 (const gchar *filename,
|
|||||||
int result;
|
int result;
|
||||||
gsize len;
|
gsize len;
|
||||||
|
|
||||||
|
if (filename == NULL)
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
len = strlen (filename);
|
len = strlen (filename);
|
||||||
|
|
||||||
while (len > 0 && G_IS_DIR_SEPARATOR (filename[len - 1]))
|
while (len > 0 && G_IS_DIR_SEPARATOR (filename[len - 1]))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user