summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2017-01-12 15:58:56 +0000
committerjsing <>2017-01-12 15:58:56 +0000
commitc165429c2dec44cd63ef44ce30351921212ed255 (patch)
tree9f37213f55734b4f1cde1ab36e8e666a3fae3212 /src
parentea2fc622f755c1cf27c685f2777e7663c9f28e1f (diff)
downloadopenbsd-c165429c2dec44cd63ef44ce30351921212ed255.tar.gz
openbsd-c165429c2dec44cd63ef44ce30351921212ed255.tar.bz2
openbsd-c165429c2dec44cd63ef44ce30351921212ed255.zip
If no callbacks are specified, return after setting an error rather than
continuing on. Also noticed by Marko Kreen.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libtls/tls_bio_cb.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lib/libtls/tls_bio_cb.c b/src/lib/libtls/tls_bio_cb.c
index 28eba24c91..813d98d990 100644
--- a/src/lib/libtls/tls_bio_cb.c
+++ b/src/lib/libtls/tls_bio_cb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_bio_cb.c,v 1.14 2016/11/04 15:45:55 jsing Exp $ */ 1/* $OpenBSD: tls_bio_cb.c,v 1.15 2017/01/12 15:58:56 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2016 Tobias Pape <tobias@netshed.de> 3 * Copyright (c) 2016 Tobias Pape <tobias@netshed.de>
4 * 4 *
@@ -176,8 +176,10 @@ tls_get_new_cb_bio(struct tls *ctx)
176 struct bio_cb *bcb; 176 struct bio_cb *bcb;
177 BIO *bio; 177 BIO *bio;
178 178
179 if (ctx->read_cb == NULL || ctx->write_cb == NULL) 179 if (ctx->read_cb == NULL || ctx->write_cb == NULL) {
180 tls_set_errorx(ctx, "no callbacks registered"); 180 tls_set_errorx(ctx, "no callbacks registered");
181 return (NULL);
182 }
181 183
182 if ((bio = BIO_new(bio_s_cb())) == NULL) { 184 if ((bio = BIO_new(bio_s_cb())) == NULL) {
183 tls_set_errorx(ctx, "failed to create callback i/o"); 185 tls_set_errorx(ctx, "failed to create callback i/o");