]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm dump log: Fixed potential crash when log header size was corrupted.
authorTimo Sirainen <tss@iki.fi>
Mon, 16 Jun 2014 12:47:12 +0000 (15:47 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 16 Jun 2014 12:47:12 +0000 (15:47 +0300)
src/doveadm/doveadm-dump-log.c

index e919939b0929478db65b0daa6161dcdcfaff6d7c..af0e4068338e39702d417689d375763e7b671107 100644 (file)
@@ -497,7 +497,9 @@ static int dump_record(int fd, uint64_t *modseq)
        }
        printf("\n");
 
-       if (hdr.size < 1024*1024) {
+       if (hdr.size < sizeof(hdr)) {
+               i_fatal("Invalid header size %u", hdr.size);
+       } else if (hdr.size < 1024*1024) {
                unsigned char *buf = t_malloc(hdr.size);
 
                ret = read(fd, buf, hdr.size - sizeof(hdr));