From: "Richard W.M. Jones" <rjo...@redhat.com>

Reviewed-by: Eric Blake <ebl...@redhat.com>
Reviewed-by: Stefan Weil <s...@weilnetz.de>

Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
---
 block/ssh.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/block/ssh.c b/block/ssh.c
index b4e048c..93a8b53 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -387,15 +387,13 @@ static int check_host_key(BDRVSSHState *s, const char 
*host, int port,
     }
 
     /* host_key_check=md5:xx:yy:zz:... */
-    if (strlen(host_key_check) >= 4 &&
-        strncmp(host_key_check, "md5:", 4) == 0) {
+    if (strncmp(host_key_check, "md5:", 4) == 0) {
         return check_host_key_hash(s, &host_key_check[4],
                                    LIBSSH2_HOSTKEY_HASH_MD5, 16);
     }
 
     /* host_key_check=sha1:xx:yy:zz:... */
-    if (strlen(host_key_check) >= 5 &&
-        strncmp(host_key_check, "sha1:", 5) == 0) {
+    if (strncmp(host_key_check, "sha1:", 5) == 0) {
         return check_host_key_hash(s, &host_key_check[5],
                                    LIBSSH2_HOSTKEY_HASH_SHA1, 20);
     }
-- 
1.8.1.4


Reply via email to