diff options
author | tb <> | 2018-08-24 19:25:31 +0000 |
---|---|---|
committer | tb <> | 2018-08-24 19:25:31 +0000 |
commit | 0f07f24d827710eec2b2d4e7fc87bb37f5bcc8d2 (patch) | |
tree | e4a1c0823eee1e1d785df49be3afce82187674f6 | |
parent | e230eb241d750f093bfddc698da266e99e17a3cc (diff) | |
download | openbsd-0f07f24d827710eec2b2d4e7fc87bb37f5bcc8d2.tar.gz openbsd-0f07f24d827710eec2b2d4e7fc87bb37f5bcc8d2.tar.bz2 openbsd-0f07f24d827710eec2b2d4e7fc87bb37f5bcc8d2.zip |
In ENGINE_up_ref(), check return value of CRYPTO_add() and report
failure accordingly.
ok jsing
-rw-r--r-- | src/lib/libcrypto/engine/eng_list.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libcrypto/engine/eng_list.c b/src/lib/libcrypto/engine/eng_list.c index 8bb1bc58f2..134866d2c6 100644 --- a/src/lib/libcrypto/engine/eng_list.c +++ b/src/lib/libcrypto/engine/eng_list.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: eng_list.c,v 1.22 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: eng_list.c,v 1.23 2018/08/24 19:25:31 tb Exp $ */ |
2 | /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL | 2 | /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL |
3 | * project 2000. | 3 | * project 2000. |
4 | */ | 4 | */ |
@@ -373,10 +373,12 @@ ENGINE_by_id(const char *id) | |||
373 | int | 373 | int |
374 | ENGINE_up_ref(ENGINE *e) | 374 | ENGINE_up_ref(ENGINE *e) |
375 | { | 375 | { |
376 | int refs; | ||
377 | |||
376 | if (e == NULL) { | 378 | if (e == NULL) { |
377 | ENGINEerror(ERR_R_PASSED_NULL_PARAMETER); | 379 | ENGINEerror(ERR_R_PASSED_NULL_PARAMETER); |
378 | return 0; | 380 | return 0; |
379 | } | 381 | } |
380 | CRYPTO_add(&e->struct_ref, 1, CRYPTO_LOCK_ENGINE); | 382 | refs = CRYPTO_add(&e->struct_ref, 1, CRYPTO_LOCK_ENGINE); |
381 | return 1; | 383 | return refs > 1 ? 1 : 0; |
382 | } | 384 | } |