summaryrefslogtreecommitdiff
path: root/kex.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2019-09-06 01:58:50 +0000
committerDamien Miller <djm@mindrot.org>2019-09-06 12:01:45 +1000
commit00865c29690003b4523cc09a0e104724b9f911a4 (patch)
treebe6d9a29edb877fc52ad3e50914c2d921bb1fd1c /kex.c
parentafdf27f5aceb4973b9f5308f4310c6e3fd8db1fb (diff)
upstream: better error code for bad arguments; inspired by
OpenBSD-Commit-ID: dfc263b6041de7f0ed921a1de0b81ddebfab1e0a
Diffstat (limited to 'kex.c')
-rw-r--r--kex.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kex.c b/kex.c
index 1eb27264a..84f8e2aa9 100644
--- a/kex.c
+++ b/kex.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: kex.c,v 1.152 2019/09/05 09:35:19 djm Exp $ */ 1/* $OpenBSD: kex.c,v 1.153 2019/09/06 01:58:50 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * 4 *
@@ -223,7 +223,10 @@ kex_assemble_names(char **listp, const char *def, const char *all)
223 char *list = NULL, *ret = NULL, *matching = NULL, *opatterns = NULL; 223 char *list = NULL, *ret = NULL, *matching = NULL, *opatterns = NULL;
224 int r = SSH_ERR_INTERNAL_ERROR; 224 int r = SSH_ERR_INTERNAL_ERROR;
225 225
226 if (listp == NULL || *listp == NULL || **listp == '\0') { 226 if (listp == NULL || def == NULL || all == NULL)
227 return SSH_ERR_INVALID_ARGUMENT;
228
229 if (*listp == NULL || **listp == '\0') {
227 if ((*listp = strdup(def)) == NULL) 230 if ((*listp = strdup(def)) == NULL)
228 return SSH_ERR_ALLOC_FAIL; 231 return SSH_ERR_ALLOC_FAIL;
229 return 0; 232 return 0;