[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#219889: anna: Poorly handles commas in components descriptions



Package: anna
Version: 0.044
Severity: normal
Tags: patch

When selecting which components to load, commas in udeb description
cause debconf to split the list item in two.

I suggest the following fix to be applied (strip out commas in
package_to_choice, in util.c) :

Index: util.c
===================================================================
RCS file: /cvs/debian-boot/debian-installer/anna/util.c,v
retrieving revision 1.26
diff -u -r1.26 util.c
--- util.c	2 Nov 2003 23:07:24 -0000	1.26
+++ util.c	9 Nov 2003 21:34:11 -0000
@@ -141,10 +141,29 @@
     return ret;
 }
 
+static size_t 
+choice_strcpy(char *dest, char *src, size_t size)
+{
+    size_t n=0;
+    
+    while (*src && (n < size-1)) {
+        if (*src != ',')
+	    dest[n++] = *src;
+	src++;
+    }
+    dest[n] = '\0';
+
+    return n;
+}
+
 size_t
 package_to_choice(di_package *package, char *buf, size_t size)
 {
-  return snprintf(buf, size, "%s: %s", package->package, package->short_description);
+    int n;
+    n  = choice_strcpy(buf, package->package, size);
+    n += choice_strcpy(buf+n, ": ", size-n);
+    n += choice_strcpy(buf+n, package->short_description, size-n);
+    return n;
 }
 
 char *


-- 
Jeremie Koenig <sprite@sprite.fr.eu.org>



Reply to: