]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
istream-decrypt: Correctly check the header length for v1
authorAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 27 Jun 2016 10:19:35 +0000 (13:19 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 27 Jun 2016 10:19:35 +0000 (13:19 +0300)
src/lib-dcrypt/istream-decrypt.c

index 87b954dd70d51d87cf94b22c61d22ab00e25eabc..4ca35880b222738369d00a4b318da776bbb14a57 100644 (file)
@@ -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;
        }