Re: [evolution-patches] patch for #42212



On Thu, 2003-05-08 at 01:29, JP Rosevear wrote:
> On Wed, 2003-05-07 at 18:22, Rodrigo Moya wrote:
> > On Wed, 2003-05-07 at 18:30, JP Rosevear wrote:
> > > If we're going to making passing a null string an invalid param, we need
> > > to check everywhere that we don't pass a null param in.
> > > 
> > all callers of e_uri_new are expected to check the return value, since
> > the URI might be an invalid one. A grep over the sources shows that all
> > cases check for the return value.
> 
> Yes, but g_return_val_if_fail implies that a NULL uri string should
> never be passed in at all.  If its allowed, then the check should be
> 
> if (!string)
>     return;
> 
> or something similar.
> 
right, new patch attached
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/e-util/ChangeLog,v
retrieving revision 1.387
diff -u -p -r1.387 ChangeLog
--- ChangeLog	5 May 2003 00:56:34 -0000	1.387
+++ ChangeLog	8 May 2003 10:21:52 -0000
@@ -1,3 +1,9 @@
+2003-05-07  Rodrigo Moya <rodrigo ximian com>
+
+	Fixes crash in #42212
+
+	* e-url.c (e_uri_new): check for 'uri_string' being NULL.
+
 2003-05-02  Not Zed  <NotZed Ximian com>
 
 	* e-request.c (e_request_string): remove the assert, if we dont
Index: e-url.c
===================================================================
RCS file: /cvs/gnome/evolution/e-util/e-url.c,v
retrieving revision 1.10
diff -u -p -r1.10 e-url.c
--- e-url.c	5 Feb 2003 21:58:38 -0000	1.10
+++ e-url.c	8 May 2003 10:21:52 -0000
@@ -115,6 +115,9 @@ e_uri_new (const char *uri_string)
 	const char *end, *hash, *colon, *semi, *at, *slash, *question;
 	const char *p;
 
+	if (!uri_string)
+		return NULL;
+
 	uri = g_new0 (EUri, 1);
 
 	/* find fragment */


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