[dovecot-cvs] dovecot: Don't bother checking record sizes here. They're alread...

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 13 22:13:55 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/e0feb74cf46e
changeset: 5724:e0feb74cf46e
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 13 22:13:51 2007 +0300
description:
Don't bother checking record sizes here. They're already checked elsewhere,
and most records are variable sized so they can't even be checked here.

diffstat:

1 file changed, 27 deletions(-)
src/lib-index/mail-transaction-log-view.c |   27 ---------------------------

diffs (49 lines):

diff -r ad695be143ff -r e0feb74cf46e src/lib-index/mail-transaction-log-view.c
--- a/src/lib-index/mail-transaction-log-view.c	Wed Jun 13 22:11:43 2007 +0300
+++ b/src/lib-index/mail-transaction-log-view.c	Wed Jun 13 22:13:51 2007 +0300
@@ -451,9 +451,7 @@ log_view_get_next(struct mail_transactio
 {
 	const struct mail_transaction_header *hdr;
 	struct mail_transaction_log_file *file;
-	const struct mail_transaction_type_map *type_rec;
 	const void *data;
-	unsigned int record_size;
 	enum mail_transaction_type rec_type;
 	uint32_t full_size;
 	size_t file_size;
@@ -497,35 +495,10 @@ log_view_get_next(struct mail_transactio
 	rec_type = hdr->type & MAIL_TRANSACTION_TYPE_MASK;
 	full_size = mail_index_offset_to_uint32(hdr->size);
 	if (full_size < sizeof(*hdr)) {
-		/* we'll fail below with "records size too small" */
-		type_rec = NULL;
-		record_size = 0;
-	} else {
-		type_rec = mail_transaction_type_lookup(hdr->type);
-		if (type_rec != NULL)
-			record_size = type_rec->record_size;
-		else {
-			mail_transaction_log_file_set_corrupted(file,
-				"unknown record type 0x%x", rec_type);
-			return -1;
-		}
-	}
-
-	if (full_size < sizeof(*hdr) + record_size) {
 		mail_transaction_log_file_set_corrupted(file,
 			"record size too small (type=0x%x, "
 			"offset=%"PRIuUOFF_T", size=%u)",
 			rec_type, view->cur_offset, full_size);
-		return -1;
-	}
-
-	if (record_size != 0 &&
-	    (full_size - sizeof(*hdr)) % record_size != 0) {
-		mail_transaction_log_file_set_corrupted(file,
-			"record size wrong (type 0x%x, "
-			"offset=%"PRIuUOFF_T", size=%"PRIuSIZE_T" %% %u != 0)",
-			rec_type, view->cur_offset, (full_size - sizeof(*hdr)),
-			record_size);
 		return -1;
 	}
 


More information about the dovecot-cvs mailing list