qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-trivial] [PATCH] ssh: Remove unnecessary use of strlen function.
Date: Fri, 19 Apr 2013 06:07:12 +0200	[thread overview]
Message-ID: <5170C2F0.4040808@weilnetz.de> (raw)
In-Reply-To: <1366319373-12926-1-git-send-email-rjones@redhat.com>

Am 18.04.2013 23:09, schrieb Richard W.M. Jones:
> From: "Richard W.M. Jones" <rjones@redhat.com>
>
> ---
>  block/ssh.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/block/ssh.c b/block/ssh.c
> index 8f78e2e..7bc008d 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);
>      }


Reviewed-by: Stefan Weil <sw@weilnetz.de>



  parent reply	other threads:[~2013-04-19  4:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-18 21:09 [Qemu-trivial] [PATCH] ssh: Remove unnecessary use of strlen function Richard W.M. Jones
2013-04-18 21:24 ` [Qemu-trivial] [Qemu-devel] " Eric Blake
2013-04-19  4:07 ` Stefan Weil [this message]
2013-04-19  9:45 ` [Qemu-trivial] " 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=5170C2F0.4040808@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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).