From: Neil Horman Date: Wed, 24 Jul 2024 20:10:53 +0000 (-0400) Subject: Fix coverity-993406 X-Git-Tag: openssl-3.4.0-alpha1~274 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=31cd9cd830f847c0effc7c15b814f890228c3739;p=thirdparty%2Fopenssl.git 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 Reviewed-by: Tom Cosgrove (Merged from https://github.com/openssl/openssl/pull/24995) --- diff --git a/test/cmsapitest.c b/test/cmsapitest.c index 5839eb74310..0684afd10e6 100644 --- a/test/cmsapitest.c +++ b/test/cmsapitest.c @@ -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)