aboutsummaryrefslogtreecommitdiff
path: root/debian/patches/use-g_strdup.patch
blob: 9651da214bd18675c3a219bfab8cd0bccec76246 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Description: Use g_strdup() to pass strings to g_hash_table_insert()
 Otherwise use-after-free happens soon.
Author: Dmitry Borisyuk <q1werty@i.com.ua>
--- a/fbxkb.c
+++ b/fbxkb.c
@@ -266,7 +266,6 @@
 {
     GdkPixbuf *flag;
     static GString *s = NULL;
-    char tmp[3];
     
     ENTER;
     g_assert(sym != NULL && strlen(sym) > 1);
@@ -281,10 +280,7 @@
     flag = gdk_pixbuf_new_from_file_at_size(s->str, 24, 24, NULL);
     if (!flag)
         RET(zzflag);
-    tmp[0] = sym[0];
-    tmp[1] = sym[1];
-    tmp[2] = 0;
-    g_hash_table_insert(sym2pix, tmp, flag);
+    g_hash_table_insert(sym2pix, g_strdup(sym), flag);
     RET(flag);
 }
 
bgstack15