Fix the check of UI_method_set_ex_data
authorPeiwei Hu <jlu.hpw@foxmail.com>
Tue, 24 May 2022 15:10:29 +0000 (23:10 +0800)
committerTomas Mraz <tomas@openssl.org>
Fri, 27 May 2022 05:57:43 +0000 (07:57 +0200)
UI_method_set_ex_data returns 0 and 1 instead of  negative numbers.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18397)

crypto/ui/ui_util.c

index 54fa43f0cc2e881bbd6ddf38101a530bebf63a45..80297969ab1d660502975344f7995517ad0f311f 100644 (file)
@@ -153,7 +153,7 @@ UI_METHOD *UI_UTIL_wrap_read_pem_callback(pem_password_cb *cb, int rwflag)
         || UI_method_set_writer(ui_method, ui_write) < 0
         || UI_method_set_closer(ui_method, ui_close) < 0
         || !RUN_ONCE(&get_index_once, ui_method_data_index_init)
-        || UI_method_set_ex_data(ui_method, ui_method_data_index, data) < 0) {
+        || !UI_method_set_ex_data(ui_method, ui_method_data_index, data)) {
         UI_destroy_method(ui_method);
         OPENSSL_free(data);
         return NULL;