diff options
author | 2020-03-06 18:20:02 +0000 | |
---|---|---|
committer | 2020-03-06 18:20:02 +0000 | |
commit | 7b4417159a31ee815a046c099707fc21b47dead4 (patch) | |
tree | 9e4bcb474074f6ef8ab0c7bd18eb31f43f494f93 /usr.bin/ssh/ssh.c | |
parent | fix uninitialized pointers for forward_cancel; ok djm (diff) | |
download | wireguard-openbsd-7b4417159a31ee815a046c099707fc21b47dead4.tar.xz wireguard-openbsd-7b4417159a31ee815a046c099707fc21b47dead4.zip |
initialize cname in case ai_canonname is NULL or too long; ok djm
Diffstat (limited to 'usr.bin/ssh/ssh.c')
-rw-r--r-- | usr.bin/ssh/ssh.c | 5 |
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__, |