qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>,
	"Richard W.M. Jones" <rjones@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 7/8] ssh: Remove unnecessary use of strlen function.
Date: Fri, 19 Apr 2013 13:34:00 +0200	[thread overview]
Message-ID: <1366371241-23430-8-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1366371241-23430-1-git-send-email-stefanha@redhat.com>

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

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 | 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

  parent reply	other threads:[~2013-04-19 11:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19 11:33 [Qemu-devel] [PULL 0/8] Trivial patches for 13 to 19 April 2013 Stefan Hajnoczi
2013-04-19 11:33 ` [Qemu-devel] [PATCH 1/8] bswap: fix compiler warning Stefan Hajnoczi
2013-04-19 11:33 ` [Qemu-devel] [PATCH 2/8] virtio.h: drop unused function prototypes Stefan Hajnoczi
2013-04-19 11:33 ` [Qemu-devel] [PATCH 3/8] Remove unneeded type casts Stefan Hajnoczi
2013-04-19 11:33 ` [Qemu-devel] [PATCH 4/8] w64: Fix compiler warnings (wrong format specifier) Stefan Hajnoczi
2013-04-19 11:33 ` [Qemu-devel] [PATCH 5/8] linux-user: change do_semop to return target errno when unsuccessful Stefan Hajnoczi
2013-04-19 11:33 ` [Qemu-devel] [PATCH 6/8] block/ssh: Add missing gcc format attributes Stefan Hajnoczi
2013-04-19 11:34 ` Stefan Hajnoczi [this message]
2013-04-19 11:34 ` [Qemu-devel] [PATCH 8/8] m25p80: Remove bogus include of devices.h Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1366371241-23430-8-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rjones@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).