changeset 12847:890a46b3ab63

dbox: Fixed wrong error check while reading external attachments.
author Timo Sirainen <tss@iki.fi>
date Mon, 14 Mar 2011 19:43:31 +0200
parents 0a1a0d33c1b2
children 31d8d43fa6b5
files src/lib-storage/index/dbox-common/dbox-attachment.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-common/dbox-attachment.c	Sat Mar 12 17:43:46 2011 +0200
+++ b/src/lib-storage/index/dbox-common/dbox-attachment.c	Mon Mar 14 19:43:31 2011 +0200
@@ -170,9 +170,6 @@
 		if (extref->start_offset != last_voffset) {
 			uoff_t part_size = extref->start_offset - last_voffset;
 
-			input = i_stream_create_limit(*stream, part_size);
-			array_append(&streams, &input, 1);
-			i_stream_seek(*stream, (*stream)->v_offset + part_size);
 			if ((*stream)->v_offset + part_size > psize) {
 				*error_r = t_strdup_printf(
 					"ext-refs point outside message "
@@ -180,6 +177,10 @@
 					(*stream)->v_offset, part_size, psize);
 				ret = 0;
 			}
+
+			input = i_stream_create_limit(*stream, part_size);
+			array_append(&streams, &input, 1);
+			i_stream_seek(*stream, (*stream)->v_offset + part_size);
 			last_voffset += part_size;
 		}