[Pkg-utopia-commits] r1895 - in /packages/unstable/hal/debian: changelog patches/85_fix_strlist_to_string.patch
sjoerd at users.alioth.debian.org
sjoerd at users.alioth.debian.org
Sun Dec 2 21:32:06 UTC 2007
Author: sjoerd
Date: Sun Dec 2 21:32:05 2007
New Revision: 1895
URL: http://svn.debian.org/wsvn/pkg-utopia/?sc=1&rev=1895
Log:
* debian/patches/85_fix_strlist_to_string.patch:
- Added. Fix strlist to string conversion to no longer use a static
buffer. As a side-effect fix an issue of strings not being properly
terminated on overflow. Which would cause garbage being sent over dbus
to the runner, causing it to exit (Closes: #445861, #447860)
Added:
packages/unstable/hal/debian/patches/85_fix_strlist_to_string.patch
Modified:
packages/unstable/hal/debian/changelog
Modified: packages/unstable/hal/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/hal/debian/changelog?rev=1895&op=diff
==============================================================================
--- packages/unstable/hal/debian/changelog (original)
+++ packages/unstable/hal/debian/changelog Sun Dec 2 21:32:05 2007
@@ -1,3 +1,13 @@
+hal (0.5.10-4) UNRELEASED; urgency=low
+
+ * debian/patches/85_fix_strlist_to_string.patch:
+ - Added. Fix strlist to string conversion to no longer use a static
+ buffer. As a side-effect fix an issue of strings not being properly
+ terminated on overflow. Which would cause garbage being sent over dbus
+ to the runner, causing it to exit (Closes: #445861, #447860)
+
+ -- Sjoerd Simons <sjoerd at debian.org> Sun, 25 Nov 2007 13:28:28 +0100
+
hal (0.5.10-3) unstable; urgency=low
* debian/patches/75_glist_memleak.patch
Added: packages/unstable/hal/debian/patches/85_fix_strlist_to_string.patch
URL: http://svn.debian.org/wsvn/pkg-utopia/packages/unstable/hal/debian/patches/85_fix_strlist_to_string.patch?rev=1895&op=file
==============================================================================
--- packages/unstable/hal/debian/patches/85_fix_strlist_to_string.patch (added)
+++ packages/unstable/hal/debian/patches/85_fix_strlist_to_string.patch Sun Dec 2 21:32:05 2007
@@ -1,0 +1,55 @@
+commit 533e321c80db8a29fa562c498c8c0199d61cf039
+Author: Sjoerd Simons <sjoerd at luon.net>
+Date: Sun Dec 2 22:17:27 2007 +0100
+
+ use GString to convert a strlist propery to string instead of a static buffer
+
+ Instead of a static 256 chars buffer use a GString when converting strlist
+ properties to string. This prevents clipping the list.
+
+ Also fixes a hal crash because the old code didn't do a proper \0 terminate
+ when the string overflowed (strncpy is a very nice function *cough*).
+ Eventually the string containing garbage would be passed over dbus to the
+ runner which would disconnect from the private bus.
+
+diff --git a/hald/device.c b/hald/device.c
+index 9514c9d..a3b84f4 100644
+--- a/hald/device.c
++++ b/hald/device.c
+@@ -160,28 +160,19 @@ hal_property_to_string (HalProperty *prop)
+ case HAL_PROPERTY_TYPE_STRLIST:
+ {
+ GSList *iter;
+- guint i;
+- char buf[256];
++ GString *buf;
++
++ buf = g_string_new ("");
+
+- i = 0;
+- buf[0] = '\0';
+- for (iter = hal_property_get_strlist (prop);
+- iter != NULL && i < sizeof(buf);
++ for (iter = hal_property_get_strlist (prop); iter != NULL;
+ iter = g_slist_next (iter)) {
+- guint len;
+- const char *str;
+-
+- str = (const char *) iter->data;
+- len = strlen (str);
+- strncpy (buf + i, str, sizeof(buf) - i);
+- i += len;
++ g_string_append (buf, (const char *) iter->data);
+
+- if (g_slist_next (iter) != NULL && i < sizeof(buf)) {
+- buf[i] = '\t';
+- i++;
++ if (g_slist_next (iter) != NULL) {
++ g_string_append_c(buf, '\t');
+ }
+ }
+- return g_strdup (buf);
++ return g_string_free (buf, FALSE);
+ }
+
+ default:
More information about the Pkg-utopia-commits
mailing list