[libsoup] [SoupURI] additional fixes to previous commit



commit 0375fe59093058d4987af5d74a53a283c3651000
Author: Dan Winship <danw gnome org>
Date:   Sun Feb 14 22:38:41 2010 -0500

    [SoupURI] additional fixes to previous commit

 libsoup/soup-uri.c  |    2 ++
 tests/uri-parsing.c |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-uri.c b/libsoup/soup-uri.c
index b1e5e59..77a0653 100644
--- a/libsoup/soup-uri.c
+++ b/libsoup/soup-uri.c
@@ -198,6 +198,8 @@ soup_uri_new_with_base (SoupURI *base, const char *uri_string)
 		uri_string += 2;
 
 		path = uri_string + strcspn (uri_string, "/?#");
+		if (path > end)
+			path = end;
 		at = strchr (uri_string, '@');
 		if (at && at < path) {
 			colon = strchr (uri_string, ':');
diff --git a/tests/uri-parsing.c b/tests/uri-parsing.c
index 49a92a6..c5aa6b5 100644
--- a/tests/uri-parsing.c
+++ b/tests/uri-parsing.c
@@ -59,6 +59,8 @@ static struct {
 	  "http://host/path%20with%20spaces"; },
 	{ "  http://host/path";, "http://host/path"; },
 	{ "http://host/path  ", "http://host/path"; },
+	{ "http://host  ", "http://host/"; },
+	{ "http://host:999  ", "http://host:999/"; },
 	{ "http://host/pa\nth";, "http://host/path"; },
 	{ "http:\r\n//host/path", "http://host/path"; },
 	{ "http://\thost/path";, "http://host/path"; },



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