[glib/glib-2-62: 1/2] gwinhttpvfs: Handle g_get_prgname() returning NULL



commit 32fe7ad93625d567dacc5c79408d58a4577c8e8c
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Sun Oct 6 20:05:44 2019 +0200

    gwinhttpvfs: Handle g_get_prgname() returning NULL
    
    When prgname wasn't set NULL would be passed to g_utf8_to_utf16()
    resulting in "g_utf8_to_utf16: assertion 'str != NULL' failed"

 gio/win32/gwinhttpvfs.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/gio/win32/gwinhttpvfs.c b/gio/win32/gwinhttpvfs.c
index 91d7fed9d..3dfac259e 100644
--- a/gio/win32/gwinhttpvfs.c
+++ b/gio/win32/gwinhttpvfs.c
@@ -121,12 +121,13 @@ static void
 g_winhttp_vfs_init (GWinHttpVfs *vfs)
 {
   wchar_t *wagent;
+  const gchar *prgname = g_get_prgname ();
 
   vfs->wrapped_vfs = g_vfs_get_local ();
 
-  wagent = g_utf8_to_utf16 (g_get_prgname (), -1, NULL, NULL, NULL);
-
-  if (!wagent)
+  if (prgname)
+    wagent = g_utf8_to_utf16 (prgname, -1, NULL, NULL, NULL);
+  else
     wagent = g_utf8_to_utf16 ("GWinHttpVfs", -1, NULL, NULL, NULL);
 
   vfs->session = (G_WINHTTP_VFS_GET_CLASS (vfs)->funcs->pWinHttpOpen)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]