components/gnome/glib2/patches/14-gstrerror.patch
changeset 6614 ff27f2901f5d
equal deleted inserted replaced
6613:7a9aec6e5daf 6614:ff27f2901f5d
       
     1 Fix from upstream git for:
       
     2 Bug 24458406 - g_strerror caches and tries to reuse a pointer to a stack buffer
       
     3 
       
     4 Included in later 2.48 release upstream.
       
     5 
       
     6 From f87e002313d566dcce71a9aba040d22ddb5c1e80 Mon Sep 17 00:00:00 2001
       
     7 From: Dan Winship <[email protected]>
       
     8 Date: Mon, 16 Nov 2015 16:57:38 -0500
       
     9 Subject: [PATCH] Fix g_strerror() on non-glibc
       
    10 
       
    11 When using one of the codepaths that copies the error string into buf,
       
    12 make sure the string gets strdup() afterward.
       
    13 
       
    14 https://bugzilla.gnome.org/show_bug.cgi?id=758194
       
    15 ---
       
    16  glib/gstrfuncs.c | 2 ++
       
    17  1 file changed, 2 insertions(+)
       
    18 
       
    19 diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
       
    20 index b5a862b..975be0b 100644
       
    21 --- a/glib/gstrfuncs.c
       
    22 +++ b/glib/gstrfuncs.c
       
    23 @@ -1293,6 +1293,8 @@ g_strerror (gint errnum)
       
    24            if (error)
       
    25              g_print ("%s\n", error->message);
       
    26          }
       
    27 +      else if (msg == (const gchar *)buf)
       
    28 +        msg = g_strdup (buf);
       
    29  
       
    30        g_hash_table_insert (errors, GINT_TO_POINTER (errnum), (char *) msg);
       
    31      }
       
    32 -- 
       
    33 2.7.4
       
    34