summaryrefslogtreecommitdiffstats
path: root/lib/libtls/tls_config.c
diff options
context:
space:
mode:
authorjsing <jsing@openbsd.org>2017-09-25 18:07:03 +0000
committerjsing <jsing@openbsd.org>2017-09-25 18:07:03 +0000
commitc68c7b49da0e6e694a1667fd0c108beda3f95055 (patch)
tree2ae0b336aed27a18bf6080353d4beb839cfb938b /lib/libtls/tls_config.c
parentAnnotate some API-side memory leaks for future resolution. (diff)
downloadwireguard-openbsd-c68c7b49da0e6e694a1667fd0c108beda3f95055.tar.xz
wireguard-openbsd-c68c7b49da0e6e694a1667fd0c108beda3f95055.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 '')
-rw-r--r--lib/libtls/tls_config.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libtls/tls_config.c b/lib/libtls/tls_config.c
index 581c493a559..777dfc52f0f 100644
--- a/lib/libtls/tls_config.c
+++ b/lib/libtls/tls_config.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tls_config.c,v 1.43 2017/08/10 18:18:30 jsing Exp $ */
+/* $OpenBSD: tls_config.c,v 1.44 2017/09/25 18:07:03 jsing Exp $ */
/*
* Copyright (c) 2014 Joel Sing <jsing@openbsd.org>
*
@@ -311,6 +311,9 @@ tls_config_parse_protocols(uint32_t *protocols, const char *protostr)
char *s, *p, *q;
int negate;
+ if (protostr == NULL)
+ return TLS_PROTOCOLS_DEFAULT;
+
if ((s = strdup(protostr)) == NULL)
return (-1);