1
1

Ben Kibbey fixed the hostline() when parsing lines using only one hostname

Этот коммит содержится в:
Daniel Stenberg 2009-06-10 20:46:11 +02:00
родитель aeaf07576e
Коммит 8b46528c04

Просмотреть файл

@ -394,6 +394,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
const char *key, size_t keylen) const char *key, size_t keylen)
{ {
const char *p; const char *p;
const char *orig = host;
const char *salt = NULL; const char *salt = NULL;
int rc; int rc;
int type = LIBSSH2_KNOWNHOST_TYPE_PLAIN; int type = LIBSSH2_KNOWNHOST_TYPE_PLAIN;
@ -422,6 +423,8 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
hostlen -= scan; /* deduct what's left to scan from the first hostlen -= scan; /* deduct what's left to scan from the first
host name */ host name */
} }
else
host = orig;
} }
else { else {
/* |1|[salt]|[hash] */ /* |1|[salt]|[hash] */
@ -507,6 +510,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
return rc; return rc;
} }
host = orig;
memcpy(hostbuf, host, hostlen); memcpy(hostbuf, host, hostlen);
hostbuf[hostlen]=0; hostbuf[hostlen]=0;