From: Tomas Mraz Date: Tue, 24 Oct 2023 07:27:23 +0000 (+0200) Subject: Allow short reads in asn1_d2i_read_bio() X-Git-Tag: openssl-3.1.7~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f4a0acd962a825b90a86e538ada0166b6d71cb7;p=thirdparty%2Fopenssl.git Allow short reads in asn1_d2i_read_bio() Reviewed-by: Neil Horman Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/22486) (cherry picked from commit 202ef97edc8e5561a6f4db28919d5ed73d411cc7) --- diff --git a/crypto/asn1/a_d2i_fp.c b/crypto/asn1/a_d2i_fp.c index e8602053f97..833dc104ddc 100644 --- a/crypto/asn1/a_d2i_fp.c +++ b/crypto/asn1/a_d2i_fp.c @@ -148,6 +148,9 @@ int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb) goto err; } len += i; + if ((size_t)i < want) + continue; + } } /* else data already loaded */