From 6d88dd773a36762a01698745d7c23f1b818ee193 Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 24 Aug 2018 19:27:01 +0000 Subject: [PATCH] In DSO_up_ref(), check return value of CRYPTO_add() and report failure accordingly. ok jsing --- lib/libcrypto/dso/dso_lib.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libcrypto/dso/dso_lib.c b/lib/libcrypto/dso/dso_lib.c index 7902fbcc6e6..6dc98803ece 100644 --- a/lib/libcrypto/dso/dso_lib.c +++ b/lib/libcrypto/dso/dso_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dso_lib.c,v 1.19 2017/01/29 17:49:23 beck Exp $ */ +/* $OpenBSD: dso_lib.c,v 1.20 2018/08/24 19:27:01 tb Exp $ */ /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL * project 2000. */ @@ -174,13 +174,15 @@ DSO_flags(DSO *dso) int DSO_up_ref(DSO *dso) { + int refs; + if (dso == NULL) { DSOerror(ERR_R_PASSED_NULL_PARAMETER); return (0); } - CRYPTO_add(&dso->references, 1, CRYPTO_LOCK_DSO); - return (1); + refs = CRYPTO_add(&dso->references, 1, CRYPTO_LOCK_DSO); + return ((refs > 1) ? 1 : 0); } DSO * -- 2.20.1