libsoup.uri.1.awn.patch



Currently, soup_uri_to_string() silently crashes if URI parameter is NULL.

Attached patch uses g_return_val_if_fail(), and therefore, threats
such situation  as programming error.

Another way is to threat uri==NULL as normal situation and just return
NULL silently.

What way to use -- it's up to Dan, of couse.

-- 
Andrew W. Nosenko <andrew w nosenko gmail com>
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 1179)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@
+2008-10-09  Andrew W. Nosenko  <andrew w nosenko gmail com>
+
+	* libsoup/soup-uri.c (soup_uri_to_string) [!G_DISABLE_CHECKS]:
+	Verify whether uri is non-NULL and avoid crash on NULL pointer
+	dereference therefore.
+
 2008-10-03  Dan Winship  <danw gnome org>
 
 	* libsoup/soup-connection.c: Change the SoupURI properties to
Index: libsoup/soup-uri.c
===================================================================
--- libsoup/soup-uri.c	(revision 1179)
+++ libsoup/soup-uri.c	(working copy)
@@ -412,6 +412,8 @@ soup_uri_new (const char *uri_string)
 char *
 soup_uri_to_string (SoupURI *uri, gboolean just_path_and_query)
 {
+	g_return_val_if_fail(uri != NULL, NULL);
+
 	GString *str;
 	char *return_result;
 


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