summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2017-12-09 16:49:17 +0000
committerjsing <>2017-12-09 16:49:17 +0000
commit3ac8e6d9e8c6e22e6ff6631be712d20007956266 (patch)
tree4eb76183da4b8735f94b5c6739e41ebe3dd952d2 /src
parent8c1ed8b7e3af4b96d94cbf18ef16743f39476d74 (diff)
downloadopenbsd-3ac8e6d9e8c6e22e6ff6631be712d20007956266.tar.gz
openbsd-3ac8e6d9e8c6e22e6ff6631be712d20007956266.tar.bz2
openbsd-3ac8e6d9e8c6e22e6ff6631be712d20007956266.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libtls/tls_config.c8
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..e7a746d30b 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.44.4.1 2017/12/09 16:49:17 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);