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

Irene Huang <[email protected]>
Newsgroups gmane.comp.gnome.evolution.patches
Message-ID <[email protected]>
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
> [email protected]
> http://mail.gnome.org/mailman/listinfo/evolution-patches

_______________________________________________
Evolution-patches mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/evolution-patches
EDS-startup-crash-with-sunkerberos-331633-2-21.diff (text/x-patch, 1.5 KB)
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 <[email protected]>
+
+	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  <[email protected]>
 
 	* 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;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.