diff options
author | jsing <> | 2017-12-09 16:46:08 +0000 |
---|---|---|
committer | jsing <> | 2017-12-09 16:46:08 +0000 |
commit | f470834311fadde98f690758b95be8f61963fddb (patch) | |
tree | f7bd3c5f9a9a8ef039928c67002bc68fdd134568 | |
parent | 77b2514f6d7f453069c117c2344254a125f2bf9a (diff) | |
download | openbsd-f470834311fadde98f690758b95be8f61963fddb.tar.gz openbsd-f470834311fadde98f690758b95be8f61963fddb.tar.bz2 openbsd-f470834311fadde98f690758b95be8f61963fddb.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.
-rw-r--r-- | src/lib/libtls/tls_config.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c index 777dfc52f0..e2e3f4abaa 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.44 2017/09/25 18:07:03 jsing Exp $ */ | 1 | /* $OpenBSD: tls_config.c,v 1.45 2017/12/09 16:46:08 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,8 +311,10 @@ 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) | 314 | if (protostr == NULL) { |
315 | return TLS_PROTOCOLS_DEFAULT; | 315 | *protocols = TLS_PROTOCOLS_DEFAULT; |
316 | return (0); | ||
317 | } | ||
316 | 318 | ||
317 | if ((s = strdup(protostr)) == NULL) | 319 | if ((s = strdup(protostr)) == NULL) |
318 | return (-1); | 320 | return (-1); |