From: Andy Polyakov Date: Thu, 2 Aug 2018 07:02:47 +0000 (+0200) Subject: asn1/tasn_utl.c: fix logical error in asn1_do_lock. X-Git-Tag: OpenSSL_1_1_0i~14 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c700d1fe090acf3661d3948c25f489803f50a98b;p=oweals%2Fopenssl.git asn1/tasn_utl.c: fix logical error in asn1_do_lock. CRYPTO_atomic_add was assumed to return negative value on error, while it returns 0. Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/6843) --- diff --git a/crypto/asn1/tasn_utl.c b/crypto/asn1/tasn_utl.c index f79d7d6b44..cad45a07f5 100644 --- a/crypto/asn1/tasn_utl.c +++ b/crypto/asn1/tasn_utl.c @@ -76,7 +76,7 @@ int asn1_do_lock(ASN1_VALUE **pval, int op, const ASN1_ITEM *it) } return 1; } - if (CRYPTO_atomic_add(lck, op, &ret, *lock) < 0) + if (!CRYPTO_atomic_add(lck, op, &ret, *lock)) return -1; /* failed */ #ifdef REF_PRINT fprintf(stderr, "%p:%4d:%s\n", it, *lck, it->sname);