aboutsummaryrefslogtreecommitdiffstats
path: root/testing/msitools/fix-segfault.patch
blob: e2109ef2dd77200553423978e79cb620c68dd2f4 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
diff --git a/tools/msiinfo.c b/tools/msiinfo.c
index ac299fd..e695f14 100644
--- a/tools/msiinfo.c
+++ b/tools/msiinfo.c
@@ -420,7 +420,7 @@ static gboolean export_create_table(const char *table,
     guint num_columns = libmsi_record_get_field_count(names);
     guint num_keys = libmsi_record_get_field_count(keys);
     guint i, len;
-    char size[20], extra[30];
+    char size[20], extra[30], typestr[20];
     gchar *name, *type;
 
     if (!strcmp(table, "_Tables") ||
@@ -455,25 +455,25 @@ static gboolean export_create_table(const char *table,
                 /* fall through */
             case 's': case 'S':
                 strcpy(size, type+1);
-                sprintf(type, "CHAR(%s)", size);
+                sprintf(typestr, "CHAR(%s)", size);
                 break;
             case 'i': case 'I':
                 len = atol(type + 1);
                 if (len <= 2)
-                    strcpy(type, "INT");
+                    strcpy(typestr, "INT");
                 else if (len == 4)
-                    strcpy(type, "LONG");
+                    strcpy(typestr, "LONG");
                 else
                     abort();
                 break;
             case 'v': case 'V':
-                strcpy(type, "OBJECT");
+                strcpy(typestr, "OBJECT");
                 break;
             default:
                 abort();
         }
 
-        printf("`%s` %s%s", name, type, extra);
+        printf("`%s` %s%s", name, typestr, extra);
         g_free(name);
         g_free(type);
     }