Mercurial > dovecot > core-2.2
changeset 1274:f7fc5d52ac7c HEAD
Don't crash if something tries to write 0 bytes in headers while saving the
message. This happened sometimes with mbox.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 04 Mar 2003 20:51:02 +0200 |
parents | 2cf2e08a6ee9 |
children | af685269ead0 |
files | src/lib-storage/index/index-save.c |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-save.c Tue Mar 04 06:02:56 2003 +0200 +++ b/src/lib-storage/index/index-save.c Tue Mar 04 20:51:02 2003 +0200 @@ -27,7 +27,10 @@ { size_t i, start; - i_assert(size > 0 && size <= SSIZE_T_MAX); + i_assert(size <= SSIZE_T_MAX); + + if (size == 0) + return 0; start = 0; for (i = 0; i < size; i++) { @@ -58,7 +61,10 @@ { size_t i, start; - i_assert(size > 0 && size <= SSIZE_T_MAX); + i_assert(size <= SSIZE_T_MAX); + + if (size == 0) + return 0; start = 0; for (i = 0; i < size; i++) { @@ -162,7 +168,7 @@ failed = FALSE; for (;;) { data = i_stream_get_data(input, &size); - if (!failed && size > 0) { + if (!failed) { ret = write_func(output, data, size); if (ret < 0) { set_write_error(storage, output, path);