Fix coverity-993406

Coverity flagged an overflow warning in the cmsapitest.

Its pretty insignificant, but if a huge file is passed in via BIO, its
possible for the length variable returned to overflow.

Just check it as we read to silence coverity on it.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
(Merged from https://github.com/openssl/openssl/pull/24995)
This commit is contained in:
Neil Horman 2024-07-24 16:10:53 -04:00
parent bc43158797
commit 31cd9cd830

View File

@ -332,6 +332,9 @@ static unsigned char *read_all(BIO *bio, long *p_len)
if (ret < 0)
break;
if (LONG_MAX - ret < *p_len)
break;
*p_len += ret;
if (ret < step)