]> git.proxmox.com Git - qemu.git/commitdiff
ssh: Remove unnecessary use of strlen function.
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 18 Apr 2013 21:09:33 +0000 (22:09 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Fri, 19 Apr 2013 09:45:38 +0000 (11:45 +0200)
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/ssh.c

index b4e048c70fdbdc601cbc912d06b6537a7d7e1302..93a8b53ffd34b9e5c7fbb1097870e502fa94ea35 100644 (file)
@@ -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);
     }