[dovecot-cvs] dovecot/src/lib-storage/index index-search.c,1.48,1.49

cras at procontrol.fi cras at procontrol.fi
Sun Dec 8 07:23:10 EET 2002


Update of /home/cvs/dovecot/src/lib-storage/index
In directory danu:/tmp/cvs-serv19285/lib-storage/index

Modified Files:
	index-search.c 
Log Message:
Added buffer API. Point is to hide all buffer writing behind this API which
verifies that nothing overflows. Much better than doing the same checks all
around the code, even if it is slightly slower.

Buffer reading is still mostly done directly, that isn't such a big security
risk and I can't think of a reasonable API for it anyway.



Index: index-search.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-storage/index/index-search.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- index-search.c	6 Dec 2002 01:09:23 -0000	1.48
+++ index-search.c	8 Dec 2002 05:23:08 -0000	1.49
@@ -402,7 +402,7 @@
 			}
 
 			size = strlen(field);
-			ret = message_header_search(field, &size,
+			ret = message_header_search(field, size,
 						    hdr_search_ctx) ? 1 : 0;
 		}
 	}
@@ -487,15 +487,18 @@
 		return;
 	}
 
+	t_push();
+
 	/* then check if the value matches */
 	hdr_search_ctx = search_header_context(ctx->index_context, arg);
 	if (hdr_search_ctx == NULL)
 		ret = 0;
 	else {
 		len = ctx->value_len;
-		ret = message_header_search(ctx->value, &len,
+		ret = message_header_search(ctx->value, len,
 					    hdr_search_ctx) ? 1 : 0;
 	}
+	t_pop();
 
         ARG_SET_RESULT(arg, ret);
 }




More information about the dovecot-cvs mailing list