From 906b29252ccc045ff7f895bcb5fabd2be5d60c92 Mon Sep 17 00:00:00 2001 From: Gustavo Noronha Silva Date: Sun, 20 Dec 2009 01:19:47 +0100 Subject: Add sanity checks for places where we create SoupURIs SoupURI creation may fail for invalid URIs, and we would crash trying to work with the NULL pointers. --- lib/ephy-profile-migration.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/ephy-profile-migration.c b/lib/ephy-profile-migration.c index b5a32f17f..01a4a20f7 100644 --- a/lib/ephy-profile-migration.c +++ b/lib/ephy-profile-migration.c @@ -431,6 +431,8 @@ normalize_and_prepare_uri (SoupURI *uri, const char *form_username, const char *form_password) { + g_return_if_fail (uri != NULL); + /* We normalize https? schemes here so that we use passwords * we stored in https sites in their http counterparts, and * vice-versa. */ @@ -464,6 +466,9 @@ _ephy_profile_store_form_auth_data (const char *uri, g_return_if_fail (password); fake_uri = soup_uri_new (uri); + if (fake_uri == NULL) + return; + normalize_and_prepare_uri (fake_uri, form_username, form_password); fake_uri_str = soup_uri_to_string (fake_uri, FALSE); @@ -500,6 +505,9 @@ _ephy_profile_query_form_auth_data (const char *uri, g_return_val_if_fail (form_password, NULL); key = soup_uri_new (uri); + if (key == NULL) + return NULL; + normalize_and_prepare_uri (key, form_username, form_password); key_str = soup_uri_to_string (key, FALSE); -- cgit