summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ui/ui_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/ui/ui_lib.c')
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index cce9075ac1..33c86d76ef 100644
--- a/src/lib/libcrypto/ui/ui_lib.c
+++ b/src/lib/libcrypto/ui/ui_lib.c
@@ -62,6 +62,7 @@
62#include <openssl/ui.h> 62#include <openssl/ui.h>
63#include <openssl/err.h> 63#include <openssl/err.h>
64#include "ui_locl.h" 64#include "ui_locl.h"
65#include "cryptlib.h"
65 66
66IMPLEMENT_STACK_OF(UI_STRING_ST) 67IMPLEMENT_STACK_OF(UI_STRING_ST)
67 68
@@ -144,7 +145,8 @@ static UI_STRING *general_allocate_prompt(UI *ui, const char *prompt,
144 { 145 {
145 UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,ERR_R_PASSED_NULL_PARAMETER); 146 UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,ERR_R_PASSED_NULL_PARAMETER);
146 } 147 }
147 else if (result_buf == NULL) 148 else if ((type == UIT_PROMPT || type == UIT_VERIFY
149 || type == UIT_BOOLEAN) && result_buf == NULL)
148 { 150 {
149 UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER); 151 UIerr(UI_F_GENERAL_ALLOCATE_PROMPT,UI_R_NO_RESULT_BUFFER);
150 } 152 }
@@ -235,7 +237,7 @@ static int general_allocate_boolean(UI *ui,
235 return ret; 237 return ret;
236 } 238 }
237 239
238/* Returns the index to the place in the stack or 0 for error. Uses a 240/* Returns the index to the place in the stack or -1 for error. Uses a
239 direct reference to the prompt. */ 241 direct reference to the prompt. */
240int UI_add_input_string(UI *ui, const char *prompt, int flags, 242int UI_add_input_string(UI *ui, const char *prompt, int flags,
241 char *result_buf, int minsize, int maxsize) 243 char *result_buf, int minsize, int maxsize)
@@ -831,8 +833,8 @@ int UI_set_result(UI *ui, UI_STRING *uis, const char *result)
831 case UIT_PROMPT: 833 case UIT_PROMPT:
832 case UIT_VERIFY: 834 case UIT_VERIFY:
833 { 835 {
834 char number1[20]; 836 char number1[DECIMAL_SIZE(uis->_.string_data.result_minsize)+1];
835 char number2[20]; 837 char number2[DECIMAL_SIZE(uis->_.string_data.result_maxsize)+1];
836 838
837 BIO_snprintf(number1, sizeof(number1), "%d", 839 BIO_snprintf(number1, sizeof(number1), "%d",
838 uis->_.string_data.result_minsize); 840 uis->_.string_data.result_minsize);