diff options
author | 2017-12-09 16:46:08 +0000 | |
---|---|---|
committer | 2017-12-09 16:46:08 +0000 | |
commit | 568004a55bffca48ca8672baeb0f1704e0362b6e (patch) | |
tree | 61e538e7ca7d5c56c5587e39a91b36f17ceee141 /lib/libtls | |
parent | Add a regress test for tls_config_parse_protocols(). (diff) | |
download | wireguard-openbsd-568004a55bffca48ca8672baeb0f1704e0362b6e.tar.xz wireguard-openbsd-568004a55bffca48ca8672baeb0f1704e0362b6e.zip |
Make tls_config_parse_protocols() work correctly when passed a NULL pointer
for a protocol string.
Issue found by semarie@, who also provided the diff.
Diffstat (limited to 'lib/libtls')
-rw-r--r-- | lib/libtls/tls_config.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libtls/tls_config.c b/lib/libtls/tls_config.c index 777dfc52f0f..e2e3f4abaae 100644 --- a/lib/libtls/tls_config.c +++ b/lib/libtls/tls_config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tls_config.c,v 1.44 2017/09/25 18:07:03 jsing Exp $ */ +/* $OpenBSD: tls_config.c,v 1.45 2017/12/09 16:46:08 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> * @@ -311,8 +311,10 @@ tls_config_parse_protocols(uint32_t *protocols, const char *protostr) char *s, *p, *q; int negate; - if (protostr == NULL) - return TLS_PROTOCOLS_DEFAULT; + if (protostr == NULL) { + *protocols = TLS_PROTOCOLS_DEFAULT; + return (0); + } if ((s = strdup(protostr)) == NULL) return (-1); |