diff options
author | Jiasheng Jiang <jiasheng@iscas.ac.cn> | 2022-01-25 15:51:31 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-01-26 17:32:40 +0100 |
commit | 3f6a12a07f52c55dc3f4b0def42680f589f89ed4 (patch) | |
tree | d8c86da2205f048cb2adb546839c344b66318a14 /doc/man3 | |
parent | 1d28ada1c39997c10fe5392f4235bbd2bc44b40f (diff) |
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)
Diffstat (limited to 'doc/man3')
0 files changed, 0 insertions, 0 deletions