[dovecot-cvs] dovecot/src/lib-index mail-index-sync-ext.c,1.1,1.2
cras at dovecot.org
cras at dovecot.org
Sun Dec 19 03:53:32 EET 2004
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv19353
Modified Files:
mail-index-sync-ext.c
Log Message:
Don't crash if last extension in record needs padding.
Index: mail-index-sync-ext.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-ext.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mail-index-sync-ext.c 7 Dec 2004 03:59:20 -0000 1.1
+++ mail-index-sync-ext.c 19 Dec 2004 01:53:30 -0000 1.2
@@ -245,11 +245,10 @@
if (new_map->buffer->used !=
old_records_count * new_map->hdr.record_size) {
/* we didn't fully write the last record */
- i_assert(new_map->buffer->used ==
- old_records_count * new_map->hdr.record_size -
- (ext[ext_id].record_size - old_size));
- buffer_append_zero(new_map->buffer,
- ext[ext_id].record_size - old_size);
+ size_t space = old_records_count * new_map->hdr.record_size -
+ new_map->buffer->used;
+ i_assert(space < new_map->hdr.record_size);
+ buffer_append_zero(new_map->buffer, space);
}
new_map->records = buffer_get_modifyable_data(new_map->buffer, NULL);
More information about the dovecot-cvs
mailing list