Mercurial > dovecot > core-2.2
changeset 17498:b2e16f0e88db
doveadm dump log: Fixed potential crash when log header size was corrupted.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 16 Jun 2014 15:47:12 +0300 |
parents | de20b4fa60ac |
children | d6882dfa08d7 |
files | src/doveadm/doveadm-dump-log.c |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/doveadm-dump-log.c Mon Jun 16 15:42:39 2014 +0300 +++ b/src/doveadm/doveadm-dump-log.c Mon Jun 16 15:47:12 2014 +0300 @@ -497,7 +497,9 @@ } 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));