summaryrefslogtreecommitdiff
path: root/src/lib/libtls/tls_config.c
diff options
context:
space:
mode:
authorjsing <>2017-09-25 18:07:03 +0000
committerjsing <>2017-09-25 18:07:03 +0000
commit4d8ee4aa62048ceec0971789b40645cbe219bc06 (patch)
treeed31b2c3e412ef810981ff1fe232f7365b2286fa /src/lib/libtls/tls_config.c
parentbf2198bdfe9143b542ef133958510a9ed4abf154 (diff)
downloadopenbsd-4d8ee4aa62048ceec0971789b40645cbe219bc06.tar.gz
openbsd-4d8ee4aa62048ceec0971789b40645cbe219bc06.tar.bz2
openbsd-4d8ee4aa62048ceec0971789b40645cbe219bc06.zip
If tls_config_parse_protocols() is called with a NULL pointer, return the
default protocols instead of crashing - this makes the behaviour more useful and mirrors what we already do in tls_config_set_ciphers() et al.
Diffstat (limited to 'src/lib/libtls/tls_config.c')
-rw-r--r--src/lib/libtls/tls_config.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c
index 581c493a55..777dfc52f0 100644
--- a/src/lib/libtls/tls_config.c
+++ b/src/lib/libtls/tls_config.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tls_config.c,v 1.43 2017/08/10 18:18:30 jsing Exp $ */ 1/* $OpenBSD: tls_config.c,v 1.44 2017/09/25 18:07:03 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -311,6 +311,9 @@ tls_config_parse_protocols(uint32_t *protocols, const char *protostr)
311 char *s, *p, *q; 311 char *s, *p, *q;
312 int negate; 312 int negate;
313 313
314 if (protostr == NULL)
315 return TLS_PROTOCOLS_DEFAULT;
316
314 if ((s = strdup(protostr)) == NULL) 317 if ((s = strdup(protostr)) == NULL)
315 return (-1); 318 return (-1);
316 319