[glib] W32: check filename for being NULL in g_stat()
- From: LRN <ruslanizhb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] W32: check filename for being NULL in g_stat()
- Date: Tue, 22 May 2018 16:46:58 +0000 (UTC)
commit 52c45a102bb3ce53d1584a835aa91c00d00df26d
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date: Tue May 22 16:43:35 2018 +0000
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.
glib/gstdio.c | 6 ++++++
1 file changed, 6 insertions(+)
---
diff --git a/glib/gstdio.c b/glib/gstdio.c
index a374d9a51..e158de223 100644
--- a/glib/gstdio.c
+++ b/glib/gstdio.c
@@ -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]))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]