changeset 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 2a431f30af2a
children 882ea30935a9
files finch/libgnt/gntstyle.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/finch/libgnt/gntstyle.c	Fri Jul 20 21:49:53 2007 +0000
+++ b/finch/libgnt/gntstyle.c	Sat Jul 21 05:45:04 2007 +0000
@@ -145,8 +145,8 @@
 		int j;
 		GntWS *ws;
 		gchar **titles;
-		char *group = calloc(12, 1);
-		g_sprintf(group, "Workspace-%d", i);
+		char group[32];
+		g_snprintf(group, sizeof(group), "Workspace-%d", i);
 		name = g_key_file_get_value(gkfile, group, "name", NULL);
 		if (!name)
 			return;
@@ -168,7 +168,6 @@
 				g_hash_table_replace(wm->title_places, g_strdup(titles[j]), ws);
 			g_strfreev(titles);
 		}
-		g_free(group);
 	}
 #endif
 }