diff options
Diffstat (limited to 'src/lib/libcrypto/ui/ui_lib.c')
| -rw-r--r-- | src/lib/libcrypto/ui/ui_lib.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c index 106a38fa8a..1e3a4ee705 100644 --- a/src/lib/libcrypto/ui/ui_lib.c +++ b/src/lib/libcrypto/ui/ui_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ui_lib.c,v 1.40 2020/09/25 10:50:26 tb Exp $ */ | 1 | /* $OpenBSD: ui_lib.c,v 1.41 2020/09/25 10:56:36 tb Exp $ */ |
| 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL | 2 | /* Written by Richard Levitte (richard@levitte.org) for the OpenSSL |
| 3 | * project 2001. | 3 | * project 2001. |
| 4 | */ | 4 | */ |
| @@ -775,6 +775,7 @@ UI_get_result_maxsize(UI_STRING *uis) | |||
| 775 | int | 775 | int |
| 776 | UI_set_result(UI *ui, UI_STRING *uis, const char *result) | 776 | UI_set_result(UI *ui, UI_STRING *uis, const char *result) |
| 777 | { | 777 | { |
| 778 | const char *p; | ||
| 778 | int l = strlen(result); | 779 | int l = strlen(result); |
| 779 | 780 | ||
| 780 | ui->flags &= ~UI_FLAG_REDOABLE; | 781 | ui->flags &= ~UI_FLAG_REDOABLE; |
| @@ -810,25 +811,21 @@ UI_set_result(UI *ui, UI_STRING *uis, const char *result) | |||
| 810 | uis->_.string_data.result_maxsize + 1); | 811 | uis->_.string_data.result_maxsize + 1); |
| 811 | break; | 812 | break; |
| 812 | case UIT_BOOLEAN: | 813 | case UIT_BOOLEAN: |
| 813 | { | 814 | if (!uis->result_buf) { |
| 814 | const char *p; | 815 | UIerror(UI_R_NO_RESULT_BUFFER); |
| 815 | 816 | return -1; | |
| 816 | if (!uis->result_buf) { | 817 | } |
| 817 | UIerror(UI_R_NO_RESULT_BUFFER); | 818 | uis->result_buf[0] = '\0'; |
| 818 | return -1; | 819 | for (p = result; *p; p++) { |
| 820 | if (strchr(uis->_.boolean_data.ok_chars, *p)) { | ||
| 821 | uis->result_buf[0] = | ||
| 822 | uis->_.boolean_data.ok_chars[0]; | ||
| 823 | break; | ||
| 819 | } | 824 | } |
| 820 | uis->result_buf[0] = '\0'; | 825 | if (strchr(uis->_.boolean_data.cancel_chars, *p)) { |
| 821 | for (p = result; *p; p++) { | 826 | uis->result_buf[0] = |
| 822 | if (strchr(uis->_.boolean_data.ok_chars, *p)) { | 827 | uis->_.boolean_data.cancel_chars[0]; |
| 823 | uis->result_buf[0] = | 828 | break; |
| 824 | uis->_.boolean_data.ok_chars[0]; | ||
| 825 | break; | ||
| 826 | } | ||
| 827 | if (strchr(uis->_.boolean_data.cancel_chars, *p)) { | ||
| 828 | uis->result_buf[0] = | ||
| 829 | uis->_.boolean_data.cancel_chars[0]; | ||
| 830 | break; | ||
| 831 | } | ||
| 832 | } | 829 | } |
| 833 | } | 830 | } |
| 834 | default: | 831 | default: |
