summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Clapies <nclapies@entrouvert.com>2004-08-31 10:48:50 +0000
committerNicolas Clapies <nclapies@entrouvert.com>2004-08-31 10:48:50 +0000
commitcffc28fd25f92a0fe7d57a466a7f3ef978ed34fd (patch)
treebed0a7ab63316d5843edca72a4b1e28102f37fad
parentaefba020f6b316e8c463df7aa9f64c59ae3b88ea (diff)
downloadlasso-cffc28fd25f92a0fe7d57a466a7f3ef978ed34fd.tar.gz
lasso-cffc28fd25f92a0fe7d57a466a7f3ef978ed34fd.tar.xz
lasso-cffc28fd25f92a0fe7d57a466a7f3ef978ed34fd.zip
Fixed bug when attempting to parse a query message : now if a key / value with = is incomplete, it skips it and completes the process of the list
-rw-r--r--lasso/xml/tools.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lasso/xml/tools.c b/lasso/xml/tools.c
index c5eb6d51..4f630aff 100644
--- a/lasso/xml/tools.c
+++ b/lasso/xml/tools.c
@@ -234,13 +234,28 @@ lasso_query_to_dict(const gchar *query)
i = 0;
sa1 = g_strsplit(query, "&", 0);
+
while (sa1[i++] != NULL) {
/* split of key=value to get (key, value) sub-strings */
sa2 = g_strsplit(sa1[i-1], "=", 0);
+ /* if no key / value found, then continue */
+ if (sa2 == NULL) {
+ continue;
+ }
+ /* if only a key but no value, then continue */
+ if (sa2[1] == NULL) {
+ continue;
+ }
+
/* printf("%s => ", sa2[0]); */
/* split of value to get mutli values sub-strings separated by SPACE char */
str_unescaped = lasso_str_unescape(sa2[1]);
sa3 = g_strsplit(str_unescaped, " ", 0);
+ if (sa3 == NULL) {
+ g_strfreev(sa2);
+ continue;
+ }
+
xmlFree(str_unescaped);
gpa = g_ptr_array_new();
j = 0;