diff options
-rw-r--r-- | ssh.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh.c,v 1.520 2020/02/18 08:49:49 dtucker Exp $ */ | 1 | /* $OpenBSD: ssh.c,v 1.521 2020/03/06 18:20:02 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -248,6 +248,8 @@ resolve_host(const char *name, int port, int logerr, char *cname, size_t clen) | |||
248 | 248 | ||
249 | if (port <= 0) | 249 | if (port <= 0) |
250 | port = default_ssh_port(); | 250 | port = default_ssh_port(); |
251 | if (cname != NULL) | ||
252 | *cname = '\0'; | ||
251 | 253 | ||
252 | snprintf(strport, sizeof strport, "%d", port); | 254 | snprintf(strport, sizeof strport, "%d", port); |
253 | memset(&hints, 0, sizeof(hints)); | 255 | memset(&hints, 0, sizeof(hints)); |
@@ -477,7 +479,6 @@ resolve_canonicalize(char **hostp, int port) | |||
477 | } | 479 | } |
478 | /* Attempt each supplied suffix */ | 480 | /* Attempt each supplied suffix */ |
479 | for (i = 0; i < options.num_canonical_domains; i++) { | 481 | for (i = 0; i < options.num_canonical_domains; i++) { |
480 | *newname = '\0'; | ||
481 | xasprintf(&fullhost, "%s.%s.", *hostp, | 482 | xasprintf(&fullhost, "%s.%s.", *hostp, |
482 | options.canonical_domains[i]); | 483 | options.canonical_domains[i]); |
483 | debug3("%s: attempting \"%s\" => \"%s\"", __func__, | 484 | debug3("%s: attempting \"%s\" => \"%s\"", __func__, |