changeset 440:c54c1ca69362 HEAD

Verify memory alignment when accessing index data file.
author Timo Sirainen <tss@iki.fi>
date Wed, 16 Oct 2002 04:29:42 +0300
parents b66ccecbc8a6
children 4d77a27f7cd1
files src/lib-index/mail-index-data.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-data.c	Wed Oct 16 04:25:14 2002 +0300
+++ b/src/lib-index/mail-index-data.c	Wed Oct 16 04:29:42 2002 +0300
@@ -497,6 +497,14 @@
 		return NULL;
 	}
 
+	if ((index_rec->data_position % MEM_ALIGN_SIZE) != 0) {
+		index_data_set_corrupted(data,
+			"Data position (%"PRIuUOFF_T") is not memory aligned "
+			"for record %u", index_rec->data_position,
+			index_rec->uid);
+		return NULL;
+	}
+
 	pos = index_rec->data_position;
 	max_pos = pos + index_rec->data_size;