From: Aki Tuomi Date: Mon, 27 Jun 2016 10:19:35 +0000 (+0300) Subject: istream-decrypt: Correctly check the header length for v1 X-Git-Tag: 2.3.0.rc1~3424 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=97846eaedc4c2a12f329dba30dacdfb0b4fa7ec5;p=thirdparty%2Fdovecot%2Fcore.git istream-decrypt: Correctly check the header length for v1 --- diff --git a/src/lib-dcrypt/istream-decrypt.c b/src/lib-dcrypt/istream-decrypt.c index 87b954dd70..4ca35880b2 100644 --- a/src/lib-dcrypt/istream-decrypt.c +++ b/src/lib-dcrypt/istream-decrypt.c @@ -70,7 +70,8 @@ ssize_t i_stream_decrypt_read_header_v1(struct decrypt_istream *stream, buffer_t *key = buffer_create_dynamic(pool_datastack_create(), 256); hdr_len = ((data[0] << 8) | data[1]) + 12; - if (mlen < hdr_len) { + + if (mlen < hdr_len - pos) { /* try to read more */ return 0; }