Submitted By: Jaroslav Imrich <jaroslav.imrich@disig.sk>

The prompt_info and wrong_info parameters can be empty strings which
can produce confusing prompts. Treat empty string same as NULL.
This commit is contained in:
Dr. Stephen Henson 2010-03-12 12:48:46 +00:00
parent f6a61b140e
commit 118b90c59e

View File

@ -1201,6 +1201,11 @@ static int hwcrhk_get_pass(const char *prompt_info,
pem_password_cb *callback = NULL; pem_password_cb *callback = NULL;
void *callback_data = NULL; void *callback_data = NULL;
UI_METHOD *ui_method = NULL; UI_METHOD *ui_method = NULL;
/* Despite what the documentation says prompt_info can be
* an empty string.
*/
if (prompt_info && !*prompt_info)
prompt_info = NULL;
if (cactx) if (cactx)
{ {
@ -1302,8 +1307,10 @@ static int hwcrhk_insert_card(const char *prompt_info,
{ {
char answer; char answer;
char buf[BUFSIZ]; char buf[BUFSIZ];
/* Despite what the documentation says wrong_info can be
if (wrong_info) * an empty string.
*/
if (wrong_info && *wrong_info)
BIO_snprintf(buf, sizeof(buf)-1, BIO_snprintf(buf, sizeof(buf)-1,
"Current card: \"%s\"\n", wrong_info); "Current card: \"%s\"\n", wrong_info);
ok = UI_dup_info_string(ui, buf); ok = UI_dup_info_string(ui, buf);