Re: [evolution-patches] [evolution-data-server] Fix for bug #331633



Hi, 
Thanks for the suggestion. 
Here's the refined patch, please review. 

Thanks 

--Irene
On Mon, 2006-02-20 at 17:40, Veerapuram Varadhan wrote:
> On Sat, 2006-02-18 at 04:48 +0000, Irene Huang  wrote:
> > +       if (strlen(dn_value->str))
> > +               dn = g_strndup (dn_value->str, strlen(dn_value->str) -
> > 1);
> 
> Wouldn't it be better to store strlen() in a variable, instead of
> calling strlen twice?
> 
> Thanks,
> 
> V. Varadhan
> _______________________________________________
> Evolution-patches mailing list
> Evolution-patches gnome org
> http://mail.gnome.org/mailman/listinfo/evolution-patches
Index: servers/exchange/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/ChangeLog,v
retrieving revision 1.59
diff -u -r1.59 ChangeLog
--- servers/exchange/ChangeLog	13 Feb 2006 12:21:38 -0000	1.59
+++ servers/exchange/ChangeLog	21 Feb 2006 03:05:53 -0000
@@ -1,3 +1,10 @@
+2006-02-18  Irene Huang <Irene Huang sun com>
+
+	Fixes bug #331633
+
+	* lib/e2k-global-catalog.c: (find_domain_dn): Check to see
+	if the variable dn is zero-length or not.
+
 2006-02-13  Chenthill Palanisamy  <pchenthill novell com>
 
 	* storage/exchange-hierarchy-webdav.c: (init),
Index: servers/exchange/lib/e2k-global-catalog.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/servers/exchange/lib/e2k-global-catalog.c,v
retrieving revision 1.5
diff -u -r1.5 e2k-global-catalog.c
--- servers/exchange/lib/e2k-global-catalog.c	13 Dec 2005 03:54:28 -0000	1.5
+++ servers/exchange/lib/e2k-global-catalog.c	21 Feb 2006 03:05:53 -0000
@@ -1015,6 +1015,7 @@
 	GString *dn_value = g_string_new (NULL);
 	gchar *dn;
 	char  *sub_domain=NULL;
+	int tmpsz=0;
 
 	sub_domain = strtok (domain, ".");
 	while (sub_domain != NULL) {
@@ -1023,7 +1024,10 @@
 		g_string_append (dn_value, ",");
 		sub_domain = strtok (NULL, ".");
 	}
-	dn = g_strndup (dn_value->str, strlen(dn_value->str) - 1);
+	if (tmpsz = strlen(dn_value->str))
+		dn = g_strndup (dn_value->str, tmpsz - 1);
+	else 
+		dn = NULL;
 	g_string_free (dn_value, TRUE);
 	return dn;
 }


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