24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
authorAlan Coopersmith <Alan.Coopersmith@Oracle.COM>
Sat, 13 Aug 2016 23:42:23 -0700
changeset 6614 ff27f2901f5d
parent 6613 7a9aec6e5daf
child 6615 c59de4872b2d
24458406 g_strerror caches and tries to reuse a pointer to a stack buffer
components/gnome/glib2/patches/14-gstrerror.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/gnome/glib2/patches/14-gstrerror.patch	Sat Aug 13 23:42:23 2016 -0700
@@ -0,0 +1,34 @@
+Fix from upstream git for:
+Bug 24458406 - g_strerror caches and tries to reuse a pointer to a stack buffer
+
+Included in later 2.48 release upstream.
+
+From f87e002313d566dcce71a9aba040d22ddb5c1e80 Mon Sep 17 00:00:00 2001
+From: Dan Winship <[email protected]>
+Date: Mon, 16 Nov 2015 16:57:38 -0500
+Subject: [PATCH] Fix g_strerror() on non-glibc
+
+When using one of the codepaths that copies the error string into buf,
+make sure the string gets strdup() afterward.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=758194
+---
+ glib/gstrfuncs.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
+index b5a862b..975be0b 100644
+--- a/glib/gstrfuncs.c
++++ b/glib/gstrfuncs.c
[email protected]@ -1293,6 +1293,8 @@ g_strerror (gint errnum)
+           if (error)
+             g_print ("%s\n", error->message);
+         }
++      else if (msg == (const gchar *)buf)
++        msg = g_strdup (buf);
+ 
+       g_hash_table_insert (errors, GINT_TO_POINTER (errnum), (char *) msg);
+     }
+-- 
+2.7.4
+