openssl/crypto/ui
Jiasheng Jiang 3f6a12a07f UI: Check for NULL pointer after calling OPENSSL_memdup
The OPENSSL_memdup() is not always success, as the potential failure of
the allocation.
Then the '*pptr'could be NULL pointer but the ui_dup_method_data() will
still return 1.
In CRYPTO_dup_ex_data(), the 'storage[i]->dup_func' will not fail and
'ptr' will be used in CRYPTO_set_ex_data().
Also, if '*pptr' is NULL, I think it should also return 0 to tell the
caller that the duplication fails in order to prevernt using the NULL
pointer.
Therefore, it should be better to add the check and return 1 only if the
duplication succeed.

Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17582)
2022-01-26 17:32:40 +01:00
..
build.info Add a null UI method 2017-02-26 01:00:26 +01:00
ui_err.c Update copyright year 2021-06-17 13:24:59 +01:00
ui_lib.c Update copyright year 2021-07-29 15:41:35 +01:00
ui_local.h Fix header file include guard names 2019-09-28 20:26:36 +02:00
ui_null.c Reorganize local header files 2019-09-28 20:26:35 +02:00
ui_openssl.c close_console: Always unlock as the lock is always held 2022-01-03 10:57:39 +01:00
ui_util.c UI: Check for NULL pointer after calling OPENSSL_memdup 2022-01-26 17:32:40 +01:00