[dovecot-cvs] dovecot/src/lib-mail istream-header-filter.c, 1.20, 1.21

cras at dovecot.org cras at dovecot.org
Sat Dec 18 16:47:50 EET 2004


Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv12080

Modified Files:
	istream-header-filter.c 
Log Message:
Don't call bsearch() with zero member count, it crashes in Solaris.



Index: istream-header-filter.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/istream-header-filter.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- istream-header-filter.c	20 Oct 2004 20:19:57 -0000	1.20
+++ istream-header-filter.c	18 Dec 2004 14:47:46 -0000	1.21
@@ -107,10 +107,11 @@
 			continue;
 		}
 
-		matched = bsearch(hdr->name, mstream->headers,
-				  mstream->headers_count,
-				  sizeof(*mstream->headers),
-				  bsearch_strcasecmp) != NULL;
+		matched = mstream->headers_count == 0 ? FALSE :
+			bsearch(hdr->name, mstream->headers,
+				mstream->headers_count,
+				sizeof(*mstream->headers),
+				bsearch_strcasecmp) != NULL;
 		if (mstream->cur_line > mstream->parsed_lines &&
 		    mstream->callback != NULL) {
                         mstream->parsed_lines = mstream->cur_line;



More information about the dovecot-cvs mailing list