diff options
Diffstat (limited to 'crypto/ui/ui_lib.c')
-rw-r--r-- | crypto/ui/ui_lib.c | 44 |
1 files changed, 17 insertions, 27 deletions
diff --git a/crypto/ui/ui_lib.c b/crypto/ui/ui_lib.c index 4c74546612..fd03dc6cd0 100644 --- a/crypto/ui/ui_lib.c +++ b/crypto/ui/ui_lib.c @@ -540,10 +540,8 @@ int UI_process(UI *ui) ok = -1; } - if (ok == -1) { - ERR_raise(ERR_LIB_UI, UI_R_PROCESSING_ERROR); - ERR_add_error_data(2, "while ", state); - } + if (ok == -1) + ERR_raise_data(ERR_LIB_UI, UI_R_PROCESSING_ERROR, "while %s", state); return ok; } @@ -881,29 +879,21 @@ int UI_set_result_ex(UI *ui, UI_STRING *uis, const char *result, int len) switch (uis->type) { case UIT_PROMPT: case UIT_VERIFY: - { - char number1[DECIMAL_SIZE(uis->_.string_data.result_minsize) + 1]; - char number2[DECIMAL_SIZE(uis->_.string_data.result_maxsize) + 1]; - - BIO_snprintf(number1, sizeof(number1), "%d", - uis->_.string_data.result_minsize); - BIO_snprintf(number2, sizeof(number2), "%d", - uis->_.string_data.result_maxsize); - - if (len < uis->_.string_data.result_minsize) { - ui->flags |= UI_FLAG_REDOABLE; - ERR_raise(ERR_LIB_UI, UI_R_RESULT_TOO_SMALL); - ERR_add_error_data(5, "You must type in ", - number1, " to ", number2, " characters"); - return -1; - } - if (len > uis->_.string_data.result_maxsize) { - ui->flags |= UI_FLAG_REDOABLE; - ERR_raise(ERR_LIB_UI, UI_R_RESULT_TOO_LARGE); - ERR_add_error_data(5, "You must type in ", - number1, " to ", number2, " characters"); - return -1; - } + if (len < uis->_.string_data.result_minsize) { + ui->flags |= UI_FLAG_REDOABLE; + ERR_raise_data(ERR_LIB_UI, UI_R_RESULT_TOO_SMALL, + "You must type in %d to %d characters", + uis->_.string_data.result_minsize, + uis->_.string_data.result_maxsize); + return -1; + } + if (len > uis->_.string_data.result_maxsize) { + ui->flags |= UI_FLAG_REDOABLE; + ERR_raise_data(ERR_LIB_UI, UI_R_RESULT_TOO_LARGE, + "You must type in %d to %d characters", + uis->_.string_data.result_minsize, + uis->_.string_data.result_maxsize); + return -1; } if (uis->result_buf == NULL) { |