diff options
| author | jsing <> | 2017-12-09 16:46:08 +0000 |
|---|---|---|
| committer | jsing <> | 2017-12-09 16:46:08 +0000 |
| commit | ee9b3755cdf82561aaa667f35bea940548a389a6 (patch) | |
| tree | f7bd3c5f9a9a8ef039928c67002bc68fdd134568 /src/lib/libtls/tls_config.c | |
| parent | 672e5d7613099d2569b7419e88419851030a40b1 (diff) | |
| download | openbsd-ee9b3755cdf82561aaa667f35bea940548a389a6.tar.gz openbsd-ee9b3755cdf82561aaa667f35bea940548a389a6.tar.bz2 openbsd-ee9b3755cdf82561aaa667f35bea940548a389a6.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 'src/lib/libtls/tls_config.c')
| -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); |
