[dovecot-cvs] dovecot/src/lib-index mail-transaction-log.c, 1.55, 1.56

cras at dovecot.org cras at dovecot.org
Sat Sep 11 20:26:27 EEST 2004


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv26566

Modified Files:
	mail-transaction-log.c 
Log Message:
Make sure MAIL_TRANSACTION_EXTRA_INTRO is 4 byte padded, otherwise it
crashes.



Index: mail-transaction-log.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-transaction-log.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -d -r1.55 -r1.56
--- mail-transaction-log.c	11 Sep 2004 16:14:10 -0000	1.55
+++ mail-transaction-log.c	11 Sep 2004 17:26:24 -0000	1.56
@@ -1076,9 +1076,12 @@
 	if (size == 0)
 		return 0;
 
-	if (hdr_buf != NULL)
+	i_assert((size % 4) == 0);
+
+	if (hdr_buf != NULL) {
 		hdr_data = buffer_get_data(hdr_buf, &hdr_data_size);
-	else {
+		i_assert((hdr_data_size % 4) == 0);
+	} else {
 		hdr_data = NULL;
 		hdr_data_size = 0;
 	}
@@ -1196,6 +1199,9 @@
 	intro->name_size = strlen(einfo->name);
 	buffer_append(buf, einfo->name, intro->name_size);
 
+	if ((buf->used % 4) != 0)
+		buffer_append(buf, null4, 4 - (buf->used % 4));
+
 	ret = log_append_buffer(file, buf, NULL, MAIL_TRANSACTION_EXTRA_INTRO,
 				t->view->external);
 	t_pop();



More information about the dovecot-cvs mailing list