From 3ac8e6d9e8c6e22e6ff6631be712d20007956266 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sat, 9 Dec 2017 16:49:17 +0000 Subject: MFC: 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. --- src/lib/libtls/tls_config.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c index 777dfc52f0..e7a746d30b 100644 --- a/src/lib/libtls/tls_config.c +++ b/src/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.44.4.1 2017/12/09 16:49:17 jsing Exp $ */ /* * Copyright (c) 2014 Joel Sing * @@ -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); -- cgit v1.2.3-55-g6feb