[dovecot-cvs] dovecot/src/lib-index mail-index.c,1.80,1.81 mail-modifylog.c,1.38,1.39 mail-tree.c,1.13,1.14

cras at procontrol.fi cras at procontrol.fi
Thu Jan 9 14:35:18 EET 2003


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

Modified Files:
	mail-index.c mail-modifylog.c mail-tree.c 
Log Message:
Make sure hdr->used_file_size isn't too small.



Index: mail-index.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- mail-index.c	5 Jan 2003 13:09:52 -0000	1.80
+++ mail-index.c	9 Jan 2003 12:35:16 -0000	1.81
@@ -53,7 +53,8 @@
 		return FALSE;
 	}
 
-	if ((hdr->used_file_size - sizeof(struct mail_index_header)) %
+	if (hdr->used_file_size < sizeof(struct mail_index_header) ||
+	    (hdr->used_file_size - sizeof(struct mail_index_header)) %
 	    sizeof(struct mail_index_record) != 0) {
 		index_set_corrupted(index, "Invalid used_file_size in header "
 				    "(%"PRIuUOFF_T")",

Index: mail-modifylog.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-modifylog.c,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- mail-modifylog.c	5 Jan 2003 13:09:52 -0000	1.38
+++ mail-modifylog.c	9 Jan 2003 12:35:16 -0000	1.39
@@ -230,7 +230,8 @@
 		return FALSE;
 	}
 
-	if ((hdr->used_file_size - sizeof(struct modify_log_header)) %
+	if (hdr->used_file_size < sizeof(struct modify_log_header) ||
+	    (hdr->used_file_size - sizeof(struct modify_log_header)) %
 	    sizeof(struct modify_log_record) != 0) {
 		modifylog_set_corrupted(file,
 			"Invalid used_file_size in header (%"PRIuUOFF_T")",

Index: mail-tree.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-tree.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- mail-tree.c	5 Jan 2003 13:09:52 -0000	1.13
+++ mail-tree.c	9 Jan 2003 12:35:16 -0000	1.14
@@ -106,7 +106,8 @@
 		return FALSE;
 	}
 
-	if ((hdr->used_file_size - sizeof(struct mail_tree_header)) %
+	if (hdr->used_file_size < sizeof(struct mail_tree_header) ||
+	    (hdr->used_file_size - sizeof(struct mail_tree_header)) %
 	    sizeof(struct mail_tree_node) != 0) {
 		_mail_tree_set_corrupted(tree,
 			"Invalid used_file_size in header (%"PRIuUOFF_T")",




More information about the dovecot-cvs mailing list