From 8c7cfddfd26f9ae7e4bb9f7976bc9e4a001ca951 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Fri, 6 Mar 2009 01:06:07 +0000 Subject: [PATCH] - Fix SDP parsing to XML when it contains NULLs --- bluez-sdp-xml-with-nulls.patch | 40 ++++++++++++++++++++++++++++++++++ bluez.spec | 8 ++++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 bluez-sdp-xml-with-nulls.patch diff --git a/bluez-sdp-xml-with-nulls.patch b/bluez-sdp-xml-with-nulls.patch new file mode 100644 index 0000000..6cf345c --- /dev/null +++ b/bluez-sdp-xml-with-nulls.patch @@ -0,0 +1,40 @@ +diff --git a/common/sdp-xml.c b/common/sdp-xml.c +index 0403dcd..5f314b7 100644 +--- a/common/sdp-xml.c ++++ b/common/sdp-xml.c +@@ -239,9 +239,7 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level, + hex = 0; + + for (i = 0; i < length; i++) { +- if (value->val.str[i] == '\0') +- break; +- if (!isprint(value->val.str[i])) { ++ if (!isprint(value->val.str[i]) && value->val.str[i] != '\0') { + hex = 1; + break; + } +@@ -250,7 +248,8 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level, + if ((value->val.str[i] == '<') || + (value->val.str[i] == '>') || + (value->val.str[i] == '"') || +- (value->val.str[i] == '&')) ++ (value->val.str[i] == '&') || ++ (value->val.str[i] == '\0')) + num_chars_to_escape++; + } + +@@ -304,7 +303,13 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level, + strBuf[j++] = 'o'; + strBuf[j++] = 't'; + } +- else { ++ else if (value->val.str[i] == '\0') { ++ strBuf[j++] = '&'; ++ strBuf[j++] = '#'; ++ strBuf[j++] = '0'; ++ strBuf[j++] = '0'; ++ strBuf[j++] = ';'; ++ } else { + strBuf[j++] = value->val.str[i]; + } + } diff --git a/bluez.spec b/bluez.spec index f73d80c..1f59368 100644 --- a/bluez.spec +++ b/bluez.spec @@ -1,7 +1,7 @@ Summary: Bluetooth utilities Name: bluez Version: 4.32 -Release: 4%{?dist} +Release: 5%{?dist} License: GPLv2+ Group: Applications/System Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz @@ -12,6 +12,8 @@ Patch1: bluez-utils-oui-usage.patch # https://bugzilla.redhat.com/show_bug.cgi?id=450081 # http://thread.gmane.org/gmane.linux.bluez.kernel/1687 Patch2: bluez-try-utf8-harder.patch +# http://thread.gmane.org/gmane.linux.bluez.kernel/1688 +Patch3: bluez-sdp-xml-with-nulls.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root URL: http://www.bluez.org/ @@ -99,6 +101,7 @@ use in Bluetooth applications. %setup -q %patch1 -p0 -b .oui %patch2 -p1 -b .non-utf8-name +%patch3 -p1 -b .nulls-in-sdp-text %build %configure --enable-cups --enable-hid2hci --enable-dfutool --enable-tools --enable-bccmd --enable-gstreamer --enable-hidd --enable-pand --enable-dund @@ -191,6 +194,9 @@ fi %{_libdir}/alsa-lib/*.so %changelog +* Fri Mar 06 2009 - Bastien Nocera - 4.32-5 +- Fix SDP parsing to XML when it contains NULLs + * Thu Mar 05 2009 - Bastien Nocera - 4.32-4 - Work-around broken devices that export their names in ISO-8859-1 (#450081)