summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2013-09-27 15:51:02 +0200
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2013-09-27 15:51:02 +0200
commit1a1d443f91cfbb5100b5212bbd408ae7d8a271d0 (patch)
tree098809ad2cb6223725c0df7ee520d802638eb709
parente70a5746d551aaa8f579c50c09a14e528e4cfcfc (diff)
downloadlasso-1a1d443f91cfbb5100b5212bbd408ae7d8a271d0.tar.gz
lasso-1a1d443f91cfbb5100b5212bbd408ae7d8a271d0.tar.xz
lasso-1a1d443f91cfbb5100b5212bbd408ae7d8a271d0.zip
lasso/xml/tools.c: fix misuse of xmlURIUnescapeString
If the length argument is NULL, the full string is unescaped; the behaviour we expected is to return a 0 length string.
-rw-r--r--lasso/xml/tools.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c
index 9eb7e57b..dc70594f 100644
--- a/lasso/xml/tools.c
+++ b/lasso/xml/tools.c
@@ -933,7 +933,11 @@ urlencoded_to_strings(const char *str)
while(1) {
if (*st == '&' || *st == ';' || *st == '\0') {
ptrdiff_t len = st - st2;
- result[i] = xmlURIUnescapeString(st2, len, NULL);
+ if (len) {
+ result[i] = xmlURIUnescapeString(st2, len, NULL);
+ } else {
+ result[i] = g_malloc0(1);
+ }
i++;
st2 = st + 1;
if (*st == '\0')
@@ -1892,7 +1896,11 @@ lasso_get_relaystate_from_query(const char *query) {
message(G_LOG_LEVEL_WARNING, "Received a RelayState of size %ti > %u",
length, query_string_attribute_length_limit);
}
- result = xmlURIUnescapeString(start, length, NULL);
+ if (length) {
+ result = xmlURIUnescapeString(start, length, NULL);
+ } else {
+ result = g_malloc0(1);
+ }
}
return result;
}