Bug#219889: anna: Poorly handles commas in components descriptions
On Mon, Nov 10, 2003 at 02:11:29AM +0000, kraai@lafn.org wrote:
> It would be better to escape the commas by preceding them with a backslash.
Thanks, i didn't know debconf was offering this possibility. Here is the
new version :
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 10 Nov 2003 02:33:22 -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-2)) {
+ if (*src == ',')
+ dest[n++] = '\';
+ dest[n++] = *(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: