comparison finch/libgnt/gntstyle.c @ 18581:dcb1d1af30a1

This could have resulted in buffer overflow if the user had 10 or more workspaces.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 21 Jul 2007 05:45:04 +0000
parents 612bc00efe20
children 9f7587b86b0d 8d9913d9fe5a
comparison
equal deleted inserted replaced
18577:2a431f30af2a 18581:dcb1d1af30a1
143 143
144 for (i = 1; i < MAX_WORKSPACES; ++i) { 144 for (i = 1; i < MAX_WORKSPACES; ++i) {
145 int j; 145 int j;
146 GntWS *ws; 146 GntWS *ws;
147 gchar **titles; 147 gchar **titles;
148 char *group = calloc(12, 1); 148 char group[32];
149 g_sprintf(group, "Workspace-%d", i); 149 g_snprintf(group, sizeof(group), "Workspace-%d", i);
150 name = g_key_file_get_value(gkfile, group, "name", NULL); 150 name = g_key_file_get_value(gkfile, group, "name", NULL);
151 if (!name) 151 if (!name)
152 return; 152 return;
153 153
154 ws = gnt_ws_new(name); 154 ws = gnt_ws_new(name);
166 if (titles) { 166 if (titles) {
167 for (j = 0; j < c; ++j) 167 for (j = 0; j < c; ++j)
168 g_hash_table_replace(wm->title_places, g_strdup(titles[j]), ws); 168 g_hash_table_replace(wm->title_places, g_strdup(titles[j]), ws);
169 g_strfreev(titles); 169 g_strfreev(titles);
170 } 170 }
171 g_free(group);
172 } 171 }
173 #endif 172 #endif
174 } 173 }
175 void gnt_style_read_actions(GType type, GntBindableClass *klass) 174 void gnt_style_read_actions(GType type, GntBindableClass *klass)
176 { 175 {