- A (slightly) different fix for parsing to XML when it contains a NULL

This commit is contained in:
Bastien Nocera 2009-03-09 17:11:56 +00:00
parent 643330cb0d
commit 79f4832936
2 changed files with 8 additions and 19 deletions

View File

@ -1,5 +1,5 @@
diff --git a/common/sdp-xml.c b/common/sdp-xml.c diff --git a/common/sdp-xml.c b/common/sdp-xml.c
index 0403dcd..5f314b7 100644 index 0403dcd..c3d3934 100644
--- a/common/sdp-xml.c --- a/common/sdp-xml.c
+++ b/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, @@ -239,9 +239,7 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level,
@ -13,27 +13,13 @@ index 0403dcd..5f314b7 100644
hex = 1; hex = 1;
break; break;
} }
@@ -250,7 +248,8 @@ static void convert_raw_data_to_xml(sdp_data_t *value, int indent_level, @@ -304,7 +302,9 @@ 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++] = 'o';
strBuf[j++] = 't'; strBuf[j++] = 't';
} }
- else { - else {
+ else if (value->val.str[i] == '\0') { + else if (value->val.str[i] == '\0') {
+ strBuf[j++] = '&'; + strBuf[j++] = ' ';
+ strBuf[j++] = '#';
+ strBuf[j++] = '0';
+ strBuf[j++] = '0';
+ strBuf[j++] = ';';
+ } else { + } else {
strBuf[j++] = value->val.str[i]; strBuf[j++] = value->val.str[i];
} }

View File

@ -1,7 +1,7 @@
Summary: Bluetooth utilities Summary: Bluetooth utilities
Name: bluez Name: bluez
Version: 4.32 Version: 4.32
Release: 6%{?dist} Release: 7%{?dist}
License: GPLv2+ License: GPLv2+
Group: Applications/System Group: Applications/System
Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz
@ -13,7 +13,7 @@ Patch1: bluez-utils-oui-usage.patch
# http://thread.gmane.org/gmane.linux.bluez.kernel/1687 # http://thread.gmane.org/gmane.linux.bluez.kernel/1687
Patch2: bluez-try-utf8-harder.patch Patch2: bluez-try-utf8-harder.patch
# http://thread.gmane.org/gmane.linux.bluez.kernel/1688 # http://thread.gmane.org/gmane.linux.bluez.kernel/1688
Patch3: bluez-sdp-xml-with-nulls.patch Patch3: bluez-sdp-xml-with-nulls-2.patch
# http://thread.gmane.org/gmane.linux.bluez.kernel/1688/focus=1708 # http://thread.gmane.org/gmane.linux.bluez.kernel/1688/focus=1708
Patch4: bluez-fix-sdp-copy-for-strings-with-nulls.patch Patch4: bluez-fix-sdp-copy-for-strings-with-nulls.patch
@ -197,6 +197,9 @@ fi
%{_libdir}/alsa-lib/*.so %{_libdir}/alsa-lib/*.so
%changelog %changelog
* Mon Mar 09 2009 - Bastien Nocera <bnocera@redhat.com> - 4.32-7
- A (slightly) different fix for parsing to XML when it contains a NULL
* Mon Mar 09 2009 - Bastien Nocera <bnocera@redhat.com> - 4.32-6 * Mon Mar 09 2009 - Bastien Nocera <bnocera@redhat.com> - 4.32-6
- Fix sdp_copy_record(), so records are properly exported through D-Bus - Fix sdp_copy_record(), so records are properly exported through D-Bus