[PATCH] NULL check in gnome_vfs_uri_to_string()



gnome_vfs_uri_to_string() doesn't handle uri == NULL gracefully (certain
segfault). There are some bugs in bugzilla (in various modules) which
crash here. While I agree that the callers need to be fixed too, gnome-
vfs should handle this more defensively.

Martin

Index: libgnomevfs/gnome-vfs-uri.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-uri.c,v
retrieving revision 1.118
diff -u -p -w -r1.118 gnome-vfs-uri.c
--- libgnomevfs/gnome-vfs-uri.c	20 Jul 2004 21:44:00 -0000	1.118
+++ libgnomevfs/gnome-vfs-uri.c	17 Sep 2004 23:25:43 -0000
@@ -1105,6 +1105,8 @@ gnome_vfs_uri_to_string (const GnomeVFSU
 	GString *string;
 	gchar *result;
 
+	g_return_val_if_fail (uri != NULL, NULL);
+
 	string = g_string_new (uri->method_string);
 	g_string_append_c (string, ':');
 


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