summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2020-09-24 19:31:01 +0000
committertb <tb@openbsd.org>2020-09-24 19:31:01 +0000
commit56735cd36d757fef16e0c3e73fdcba79d92f2bae (patch)
treeb59b5c129bf284f8693376ee1bbdce229268fa09
parentFix a number of leaks in the UI_dup_* functions (diff)
downloadwireguard-openbsd-56735cd36d757fef16e0c3e73fdcba79d92f2bae.tar.xz
wireguard-openbsd-56735cd36d757fef16e0c3e73fdcba79d92f2bae.zip
Error out if ok_chars and cancel_chars overlap
It is a bit silly to push an error on the stack without erroring out, so error out if the ok_chars and cancel_chars overlap. ok jsing
-rw-r--r--lib/libcrypto/ui/ui_lib.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libcrypto/ui/ui_lib.c b/lib/libcrypto/ui/ui_lib.c
index e349cb38538..1045cb9992e 100644
--- a/lib/libcrypto/ui/ui_lib.c
+++ b/lib/libcrypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ui_lib.c,v 1.37 2020/09/24 19:29:09 tb Exp $ */
+/* $OpenBSD: ui_lib.c,v 1.38 2020/09/24 19:31:01 tb Exp $ */
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
* project 2001.
*/
@@ -216,8 +216,10 @@ general_allocate_boolean(UI *ui, const char *prompt, const char *action_desc,
UIerror(ERR_R_PASSED_NULL_PARAMETER);
goto err;
}
- if (ok_chars[strcspn(ok_chars, cancel_chars)] != '\0')
+ if (ok_chars[strcspn(ok_chars, cancel_chars)] != '\0') {
UIerror(UI_R_COMMON_OK_AND_CANCEL_CHARACTERS);
+ goto err;
+ }
if ((s = general_allocate_prompt(prompt, dup_strings, type, input_flags,
result_buf)) == NULL)