[evolution-patches] camel, 42540, crash doing send/recv really fast



i think this should fix it, the hostname lookup code wasn't checking the
right return value/initialising it, so that it could potentially try to
return an invalid buffer as valid.

 Z


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.1811
diff -u -3 -r1.1811 ChangeLog
--- ChangeLog	13 May 2003 18:10:10 -0000	1.1811
+++ ChangeLog	14 May 2003 02:26:43 -0000
@@ -1,3 +1,12 @@
+2003-05-14  Not Zed  <NotZed Ximian com>
+
+	** See bug #42540
+	
+	* camel-service.c (camel_gethostbyname): pre-initialise the error
+	return to invalid, so if we cancel, we definetly get a bad result.
+	Also, for a valid return against result, not herr.
+	(camel_gethostbyaddr): Likewise.
+
 2003-05-12  Jeffrey Stedfast  <fejj ximian com>
 
 	* providers/smtp/camel-smtp-transport.c (smtp_helo): If
Index: camel-service.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-service.c,v
retrieving revision 1.80
diff -u -3 -r1.80 camel-service.c
--- camel-service.c	25 Mar 2003 16:44:34 -0000	1.80
+++ camel-service.c	14 May 2003 02:26:43 -0000
@@ -744,6 +744,7 @@
 	msg->hostbuflen = 1024;
 	msg->hostbufmem = g_malloc(msg->hostbuflen);
 	msg->name = name;
+	msg->result = -1;
 
 #ifdef ENABLE_THREADS
 	cancel_fd = camel_operation_cancel_fd(NULL);
@@ -793,7 +794,7 @@
 
 	camel_operation_end(NULL);
 
-	if (msg->herr) {
+	if (msg->result != 0) {
  		if (!camel_exception_is_set(ex)) {
 			if (msg->herr == HOST_NOT_FOUND || msg->herr == NO_DATA)
 				camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
@@ -858,7 +859,8 @@
 	msg->name = addr;
 	msg->len = len;
 	msg->type = type;
-	
+	msg->result = -1;
+
 #ifdef ENABLE_THREADS
 	cancel_fd = camel_operation_cancel_fd (NULL);
 	if (cancel_fd == -1) {
@@ -908,7 +910,7 @@
 	
 	camel_operation_end (NULL);
 	
-	if (msg->herr) {
+	if (msg->result != 0) {
  		if (!camel_exception_is_set (ex)) {
 			if (msg->herr == HOST_NOT_FOUND || msg->herr == NO_DATA)
 				camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,


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