[libsoup] Don't crash when setting cookie for about:blank
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libsoup] Don't crash when setting cookie for about:blank
- Date: Sat, 21 Nov 2009 14:33:52 +0000 (UTC)
commit d9d564b4ad6a851fd286602453c359a9ab10ed2a
Author: Dan Winship <danw gnome org>
Date: Sat Nov 21 09:33:20 2009 -0500
Don't crash when setting cookie for about:blank
https://bugzilla.gnome.org/show_bug.cgi?id=602498
libsoup/soup-cookie-jar.c | 8 ++++++++
libsoup/soup-cookie.c | 2 ++
2 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libsoup/soup-cookie-jar.c b/libsoup/soup-cookie-jar.c
index d73bcbe..a20f288 100644
--- a/libsoup/soup-cookie-jar.c
+++ b/libsoup/soup-cookie-jar.c
@@ -267,6 +267,10 @@ soup_cookie_jar_get_cookies (SoupCookieJar *jar, SoupURI *uri,
g_return_val_if_fail (SOUP_IS_COOKIE_JAR (jar), NULL);
priv = SOUP_COOKIE_JAR_GET_PRIVATE (jar);
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ if (!SOUP_URI_VALID_FOR_HTTP (uri))
+ return NULL;
/* The logic here is a little weird, but the plan is that if
* uri->host is "www.foo.com", we will end up looking up
@@ -406,8 +410,12 @@ soup_cookie_jar_set_cookie (SoupCookieJar *jar, SoupURI *uri,
SoupCookie *soup_cookie;
g_return_if_fail (SOUP_IS_COOKIE_JAR (jar));
+ g_return_if_fail (uri != NULL);
g_return_if_fail (cookie != NULL);
+ if (!SOUP_URI_VALID_FOR_HTTP (uri))
+ return;
+
soup_cookie = soup_cookie_parse (cookie, uri);
if (soup_cookie) {
/* will steal or free soup_cookie */
diff --git a/libsoup/soup-cookie.c b/libsoup/soup-cookie.c
index 92eb385..a00967e 100644
--- a/libsoup/soup-cookie.c
+++ b/libsoup/soup-cookie.c
@@ -283,6 +283,8 @@ parse_one_cookie (const char **header_p, SoupURI *origin)
gboolean has_value;
SoupCookie *cookie;
+ g_return_val_if_fail (origin == NULL || SOUP_URI_VALID_FOR_HTTP (origin), NULL);
+
cookie = g_slice_new0 (SoupCookie);
/* Parse the NAME */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]