dovecot-1.2: logview: Handle unexpected header sizes correctly.

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 11 02:30:54 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/a5bbb3abeff8
changeset: 7809:a5bbb3abeff8
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 11 02:30:34 2008 +0300
description:
logview: Handle unexpected header sizes correctly.

diffstat:

1 file changed, 5 insertions(+)
src/util/logview.c |    5 +++++

diffs (15 lines):

diff -r 9185f2adeefb -r a5bbb3abeff8 src/util/logview.c
--- a/src/util/logview.c	Tue Jun 10 22:06:26 2008 +0300
+++ b/src/util/logview.c	Wed Jun 11 02:30:34 2008 +0300
@@ -31,6 +31,11 @@ static void dump_hdr(int fd)
 		i_fatal("file hdr read() %"PRIuSIZE_T" != %"PRIuSIZE_T,
 			ret, sizeof(hdr));
 	}
+	if (hdr.hdr_size < sizeof(hdr)) {
+		memset(PTR_OFFSET(&hdr, hdr.hdr_size), 0,
+		       sizeof(hdr) - hdr.hdr_size);
+	}
+	lseek(fd, hdr.hdr_size, SEEK_SET);
 
 	printf("version = %u.%u\n", hdr.major_version, hdr.minor_version);
 	printf("hdr size = %u\n", hdr.hdr_size);


More information about the dovecot-cvs mailing list