提交 931d5b4b 编写于 作者: D Dr. David von Oheimb

apps/cmp.c: fix crash with -batch option on OPENSSL_NO_UI_CONSOLE

Also make clear we cannot use get_ui_method() at this point.

Fixes #13494
Reviewed-by: NMatt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13497)
上级 68f9d922
...@@ -2698,13 +2698,10 @@ int cmp_main(int argc, char **argv) ...@@ -2698,13 +2698,10 @@ int cmp_main(int argc, char **argv)
ret = 0; ret = 0;
if (opt_batch) { if (opt_batch) {
UI_METHOD *ui_fallback_method;
#ifndef OPENSSL_NO_UI_CONSOLE #ifndef OPENSSL_NO_UI_CONSOLE
ui_fallback_method = UI_OpenSSL(); UI_method_set_reader(UI_OpenSSL(), NULL);
#else /* can't change get_ui_method() here as load_key_certs_crls() uses it */
ui_fallback_method = (UI_METHOD *)UI_null();
#endif #endif
UI_method_set_reader(ui_fallback_method, NULL);
} }
if (opt_engine != NULL) if (opt_engine != NULL)
......
...@@ -21,7 +21,7 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_data); ...@@ -21,7 +21,7 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_data);
int setup_ui_method(void); int setup_ui_method(void);
void destroy_ui_method(void); void destroy_ui_method(void);
const UI_METHOD *get_ui_method(void); UI_METHOD *get_ui_method(void);
extern BIO *bio_err; extern BIO *bio_err;
......
...@@ -136,7 +136,7 @@ void destroy_ui_method(void) ...@@ -136,7 +136,7 @@ void destroy_ui_method(void)
} }
} }
const UI_METHOD *get_ui_method(void) UI_METHOD *get_ui_method(void)
{ {
return ui_method; return ui_method;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册