From: Neil Horman Date: Mon, 15 Jul 2024 19:59:14 +0000 (-0400) Subject: Fix coverity-1604665 X-Git-Tag: openssl-3.1.7~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05590a929f161d632b3be3d265521c5e2d347e71;p=thirdparty%2Fopenssl.git Fix coverity-1604665 Coverity issued an error in the opt_uintmax code, detecting a potential overflow on a cast to ossl_intmax_t Looks like it was just a typo, casting m from uintmax_t to ossl_intmax_t Fix it by correcting the cast to be ossl_uintmax_t, as would be expected Theres also some conditionals that seem like they should be removed, but I'll save that for later, as there may be some corner cases in which ossl_uintmax_t isn't equal in size to uintmax_t..maybe. Fixes openssl/private#567 Reviewed-by: Paul Dale Reviewed-by: Tom Cosgrove Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/24897) (cherry picked from commit a753547eefc9739f341824a0cb0642afe7a06fcc) --- diff --git a/apps/lib/opt.c b/apps/lib/opt.c index d56964dbe7b..224d2157c6e 100644 --- a/apps/lib/opt.c +++ b/apps/lib/opt.c @@ -616,7 +616,7 @@ int opt_uintmax(const char *value, ossl_uintmax_t *result) opt_number_error(value); return 0; } - *result = (ossl_intmax_t)m; + *result = (ossl_uintmax_t)m; errno = oerrno; return 1; }