[libsoup] soup-uri: don't decode %00 in URIs



commit 93c0b8808b9cfa4cbcf3ef014385016ed8bd5038
Author: Dan Winship <danw gnome org>
Date:   Mon Dec 10 22:20:59 2012 +0100

    soup-uri: don't decode %00 in URIs
    
    We were accidentally decoding %00 to '\0' in URIs, causing a few
    WebKit tests to fail. Leave it undecoded instead.

 libsoup/soup-uri.c  |    2 +-
 tests/uri-parsing.c |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index 709d3ad..c1d5720 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -709,7 +709,7 @@ uri_normalized_copy (const char *part, int length,
 
 			c = HEXCHAR (s);
 			if (soup_char_is_uri_unreserved (c) ||
-			    strchr (unescape_extra, c)) {
+			    (c && strchr (unescape_extra, c))) {
 				*d++ = c;
 				s += 3;
 			} else {
diff --git a/tests/uri-parsing.c b/tests/uri-parsing.c
index 166a6d8..892ee2b 100644
--- a/tests/uri-parsing.c
+++ b/tests/uri-parsing.c
@@ -125,6 +125,9 @@ static struct {
 	  { "http", "", NULL, "host", 80, "/", NULL, NULL } },
 	{ "http://:@host";, "http://@host/";,
 	  { "http", "", "", "host", 80, "/", NULL, NULL } },
+
+	{ "http://host/keep%00nuls";, "http://host/keep%00nuls";,
+	  { "http", NULL, NULL, "host", 80, "/keep%00nuls", NULL, NULL } },
 };
 static int num_abs_tests = G_N_ELEMENTS(abs_tests);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]