The branch master has been updated via b84c6e86dd8ca88444207080808d1d598856041f (commit) from 378c50f63dceb3a85bb4937a3499283b10d295b6 (commit)
- Log ----------------------------------------------------------------- commit b84c6e86dd8ca88444207080808d1d598856041f Author: Pauli <pa...@openssl.org> Date: Wed Feb 9 11:17:57 2022 +1100 Change condition to avoid spurious compiler complaints. X509_TRUST_get0() is checking < 0, the code here was checking == -1. Both are equivalent in this situation but gcc-12 has conniptions about a subsequent possible NULL dereference (which isn't possible). Fixes #17665 Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17668) ----------------------------------------------------------------------- Summary of changes: crypto/x509/x509_trust.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/x509/x509_trust.c b/crypto/x509/x509_trust.c index e71db0c9a1..bf674737f8 100644 --- a/crypto/x509/x509_trust.c +++ b/crypto/x509/x509_trust.c @@ -134,7 +134,7 @@ int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), /* Get existing entry if any */ idx = X509_TRUST_get_by_id(id); /* Need a new entry */ - if (idx == -1) { + if (idx < 0) { if ((trtmp = OPENSSL_malloc(sizeof(*trtmp))) == NULL) { ERR_raise(ERR_LIB_X509, ERR_R_MALLOC_FAILURE); return 0;