pidgin/pidgin

Fix for crash when sending invalid xml entities separated by whitespace, eg "&# 3000;"
EionRobb/fix-for-crash-when-sending-invalid-xml-e-1487474010880
2017-02-19, Eion Robb
6745ecd124da
Parents 9f4a1085a774
Children b2fc9e774cb9
Fix for crash when sending invalid xml entities separated by whitespace, eg "&# 3000;"
--- a/libpurple/util.c Sat Feb 18 17:47:37 2017 +0000
+++ b/libpurple/util.c Sun Feb 19 03:13:47 2017 +0000
@@ -979,8 +979,8 @@
else if(IS_ENTITY("'"))
pln = "\'";
else if(*(text+1) == '#' &&
- (sscanf(text, "&#%u%1[;]", &pound, temp) == 2 ||
- sscanf(text, "&#x%x%1[;]", &pound, temp) == 2) &&
+ (sscanf(text, "&#%*[^ ]%u%1[;]", &pound, temp) == 2 ||
+ sscanf(text, "&#x%*[^ ]%x%1[;]", &pound, temp) == 2) &&
pound != 0) {
static char buf[7];
int buflen = g_unichar_to_utf8((gunichar)pound, buf);