diff options
author | Ricardo Mestre <mestre@cvs.openbsd.org> | 2016-11-30 07:56:24 +0000 |
---|---|---|
committer | Ricardo Mestre <mestre@cvs.openbsd.org> | 2016-11-30 07:56:24 +0000 |
commit | 121bc50407670446db455d652bbd2e46f1cc4c31 (patch) | |
tree | f9f500cbfea7b25103d88086e39ddd615dc33047 /usr.bin | |
parent | ecc0e680007a23935fc353179c5b481968b67f32 (diff) |
Check return value of tls_config_set_protocols(3) and tls_config_set_ciphers(3)
and bail out in case of failure
Feedback and OK jsing@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/nc/netcat.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c index 783aea25ed5..c103aa63501 100644 --- a/usr.bin/nc/netcat.c +++ b/usr.bin/nc/netcat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netcat.c,v 1.170 2016/11/06 13:33:30 beck Exp $ */ +/* $OpenBSD: netcat.c,v 1.171 2016/11/30 07:56:23 mestre Exp $ */ /* * Copyright (c) 2001 Eric Jackson <ericj@monkey.org> * Copyright (c) 2015 Bob Beck. All rights reserved. @@ -464,8 +464,11 @@ main(int argc, char *argv[]) if (oflag && tls_config_set_ocsp_staple_file(tls_cfg, oflag) == -1) errx(1, "%s", tls_config_error(tls_cfg)); if (TLSopt & TLS_ALL) { - tls_config_set_protocols(tls_cfg, TLS_PROTOCOLS_ALL); - tls_config_set_ciphers(tls_cfg, "all"); + if (tls_config_set_protocols(tls_cfg, + TLS_PROTOCOLS_ALL) != 0) + errx(1, "%s", tls_config_error(tls_cfg)); + if (tls_config_set_ciphers(tls_cfg, "all") != 0) + errx(1, "%s", tls_config_error(tls_cfg)); } if (!lflag && (TLSopt & TLS_CCERT)) errx(1, "clientcert is only valid with -l"); |