[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.45,
1.46 mail-index.c, 1.145, 1.146
cras at dovecot.org
cras at dovecot.org
Sun Sep 12 16:05:27 EEST 2004
- Previous message: [dovecot-cvs] dovecot/src/lib buffer.c,1.17,1.18 buffer.h,1.9,1.10
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-cache-compress.c, 1.16,
1.17 mail-cache-lookup.c, 1.20, 1.21 mail-cache-private.h,
1.14, 1.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv3073/lib-index
Modified Files:
mail-index-sync-update.c mail-index.c
Log Message:
Fix buffer_set_used_size crashes.
Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -d -r1.45 -r1.46
--- mail-index-sync-update.c 11 Sep 2004 19:21:08 -0000 1.45
+++ mail-index-sync-update.c 12 Sep 2004 13:05:24 -0000 1.46
@@ -319,7 +319,7 @@
einfo_hdr.record_offset = einfo->record_offset;
einfo_hdr.record_size = einfo->record_size;
buffer_append(hdr_buf, &einfo_hdr, sizeof(einfo_hdr));
- buffer_set_used_size(hdr_buf, hdr_buf->used + einfo->hdr_size);
+ buffer_append_zero(hdr_buf, einfo->hdr_size);
hdr = buffer_get_modifyable_data(hdr_buf, NULL);
hdr->header_size = hdr_buf->used;
Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- mail-index.c 5 Sep 2004 17:53:45 -0000 1.145
+++ mail-index.c 12 Sep 2004 13:05:24 -0000 1.146
@@ -376,7 +376,8 @@
buffer_reset(map->hdr_copy_buf);
buffer_append(map->hdr_copy_buf,
map->hdr, map->hdr->base_header_size);
- buffer_set_used_size(map->hdr_copy_buf, sizeof(*map->hdr));
+ buffer_append_zero(map->hdr_copy_buf, sizeof(*map->hdr) -
+ map->hdr->base_header_size);
mhdr = buffer_get_modifyable_data(map->hdr_copy_buf, NULL);
mhdr->base_header_size = sizeof(*map->hdr);
@@ -425,11 +426,11 @@
buffer_reset(map->hdr_copy_buf);
if (hdr.base_header_size < sizeof(hdr)) {
- buffer_append(map->hdr_copy_buf, &hdr,
- hdr.base_header_size);
- buffer_set_used_size(map->hdr_copy_buf, sizeof(hdr) +
- hdr.header_size -
- hdr.base_header_size);
+ buffer_append_zero(map->hdr_copy_buf, sizeof(hdr) +
+ hdr.header_size -
+ hdr.base_header_size);
+ buffer_write(map->hdr_copy_buf, 0,
+ &hdr, hdr.base_header_size);
/* @UNSAFE */
ret = pread_full(index->fd,
@@ -444,8 +445,8 @@
hdrp->header_size = map->hdr_copy_buf->used;
} else {
buffer_append(map->hdr_copy_buf, &hdr, pos);
- buffer_set_used_size(map->hdr_copy_buf,
- hdr.header_size);
+ buffer_append_zero(map->hdr_copy_buf,
+ hdr.header_size - pos);
/* @UNSAFE */
ret = pread_full(index->fd,
PTR_OFFSET(map->hdr_copy_buf->data,
- Previous message: [dovecot-cvs] dovecot/src/lib buffer.c,1.17,1.18 buffer.h,1.9,1.10
- Next message: [dovecot-cvs] dovecot/src/lib-index mail-cache-compress.c, 1.16,
1.17 mail-cache-lookup.c, 1.20, 1.21 mail-cache-private.h,
1.14, 1.15
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list