diff options
author | 2017-01-12 15:58:56 +0000 | |
---|---|---|
committer | 2017-01-12 15:58:56 +0000 | |
commit | e8e9d751d337b3562b0c2cf2b2964d4a70dd2fda (patch) | |
tree | 9fdefb69148f7e83d20d0ae5fc91a6d121a644e4 | |
parent | Add regress tests for libtls, which currently cover handshakes and closes (diff) | |
download | wireguard-openbsd-e8e9d751d337b3562b0c2cf2b2964d4a70dd2fda.tar.xz wireguard-openbsd-e8e9d751d337b3562b0c2cf2b2964d4a70dd2fda.zip |
If no callbacks are specified, return after setting an error rather than
continuing on.
Also noticed by Marko Kreen.
-rw-r--r-- | lib/libtls/tls_bio_cb.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libtls/tls_bio_cb.c b/lib/libtls/tls_bio_cb.c index 28eba24c914..813d98d9908 100644 --- a/lib/libtls/tls_bio_cb.c +++ b/lib/libtls/tls_bio_cb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_bio_cb.c,v 1.14 2016/11/04 15:45:55 jsing Exp $ */ +/* $OpenBSD: tls_bio_cb.c,v 1.15 2017/01/12 15:58:56 jsing Exp $ */ /* * Copyright (c) 2016 Tobias Pape <tobias@netshed.de> * @@ -176,8 +176,10 @@ tls_get_new_cb_bio(struct tls *ctx) struct bio_cb *bcb; BIO *bio; - if (ctx->read_cb == NULL || ctx->write_cb == NULL) + if (ctx->read_cb == NULL || ctx->write_cb == NULL) { tls_set_errorx(ctx, "no callbacks registered"); + return (NULL); + } if ((bio = BIO_new(bio_s_cb())) == NULL) { tls_set_errorx(ctx, "failed to create callback i/o"); |