summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorMarkus Friedl <markus@cvs.openbsd.org>2020-03-06 18:20:03 +0000
committerMarkus Friedl <markus@cvs.openbsd.org>2020-03-06 18:20:03 +0000
commitebf4b255cc7d184f536940c3a221598f85c781bd (patch)
tree661a581e8d7582a651139c258de2f6517783fb06 /usr.bin/ssh
parentc41f9c1d95948f25052a8cf5545b68ca061939da (diff)
initialize cname in case ai_canonname is NULL or too long; ok djm
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/ssh.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 211e3d1a1de..1bc5443f361 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.520 2020/02/18 08:49:49 dtucker Exp $ */
+/* $OpenBSD: ssh.c,v 1.521 2020/03/06 18:20:02 markus Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -232,6 +232,8 @@ resolve_host(const char *name, int port, int logerr, char *cname, size_t clen)
if (port <= 0)
port = default_ssh_port();
+ if (cname != NULL)
+ *cname = '\0';
snprintf(strport, sizeof strport, "%d", port);
memset(&hints, 0, sizeof(hints));
@@ -461,7 +463,6 @@ resolve_canonicalize(char **hostp, int port)
}
/* Attempt each supplied suffix */
for (i = 0; i < options.num_canonical_domains; i++) {
- *newname = '\0';
xasprintf(&fullhost, "%s.%s.", *hostp,
options.canonical_domains[i]);
debug3("%s: attempting \"%s\" => \"%s\"", __func__,