summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones2013-04-18 23:09:33 +0200
committerStefan Hajnoczi2013-04-19 11:45:38 +0200
commitc7a101f5297442de7cbee44f7a31428f0e85a09f (patch)
treead3e9873e433cfe33582faac872c1b5e605ee2a5
parentblock/ssh: Add missing gcc format attributes (diff)
downloadqemu-c7a101f5297442de7cbee44f7a31428f0e85a09f.tar.gz
qemu-c7a101f5297442de7cbee44f7a31428f0e85a09f.tar.xz
qemu-c7a101f5297442de7cbee44f7a31428f0e85a09f.zip
ssh: Remove unnecessary use of strlen function.
Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
-rw-r--r--block/ssh.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/block/ssh.c b/block/ssh.c
index b4e048c70f..93a8b53ffd 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);
}