This fixes hostname parsing when only one part is given in the host
portion:
diff --git a/src/knownhost.c b/src/knownhost.c
index 7e608b7..f2cdf56 100644
--- a/src/knownhost.c
+++ b/src/knownhost.c
@@ -394,6 +394,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
const char *key, size_t keylen)
{
const char *p;
+ const char *orig = host;
const char *salt = NULL;
int rc;
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
host name */
}
+ else
+ host = orig;
}
else {
/* |1|[salt]|[hash] */
@@ -507,6 +510,7 @@ static int hostline(LIBSSH2_KNOWNHOSTS *hosts,
return rc;
}
+ host = orig;
memcpy(hostbuf, host, hostlen);
hostbuf[hostlen]=0;
-- Ben Kibbey (bjk) @ FreeNode/OFTC/Jabber KeyID: 0xF2B33BEF ------------------------------------------------------------------------------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ libssh2-devel mailing list libssh2-devel_at_lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-develReceived on 2009-06-09