Git-Url:
http://git.frugalware.org/gitweb/gitweb.cgi?p=setup.git;a=commitdiff;h=607f33f80c8b84891d9e0bdcf001b0b6282ed911
commit 607f33f80c8b84891d9e0bdcf001b0b6282ed911
Author: Miklos Vajna <[EMAIL PROTECTED]>
Date: Sat Jan 19 02:05:00 2008 +0100
fw_checklist(): allocate item_no*256 for the input buffer
instead of the magic MAX_LEN+1, which may not be enough
closes #2707
diff --git a/src/util.c b/src/util.c
index a86361a..ef36158 100644
--- a/src/util.c
+++ b/src/util.c
@@ -509,19 +509,21 @@ GList* fw_checklist(const char *title, const char
*cprompt, int height,
int width, int menu_height, int item_no, char **items, int flag)
{
int ret;
- char my_buffer[MAX_LEN + 1] = "";
char *ptr, *ptrn;
GList *list=NULL;
- dialog_vars.input_result = my_buffer;
+ MALLOC(dialog_vars.input_result, item_no*256);
ret = dialog_checklist(title, cprompt, height, width,
menu_height, item_no, items, flag);
if (ret == DLG_EXIT_CANCEL)
return(NULL);
if(strlen(dialog_vars.input_result)==0)
+ {
// no item selected
+ FREE(dialog_vars.input_result);
return(list);
+ }
ptr=strstr(dialog_vars.input_result, "\"")+1;
while(strstr(ptr, "\" \""))
@@ -538,6 +540,7 @@ GList* fw_checklist(const char *title, const char *cprompt,
int height,
ptrn=ptr+strlen(ptr)-1;
*ptrn='\0';
list = g_list_append(list, strdup(ptr));
+ FREE(dialog_vars.input_result);
return(list);
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git