qemu-trivial
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-trivial] [PATCH] ssh: Remove unnecessary use of strlen functio


From: Stefan Weil
Subject: Re: [Qemu-trivial] [PATCH] ssh: Remove unnecessary use of strlen function.
Date: Fri, 19 Apr 2013 06:07:12 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Am 18.04.2013 23:09, schrieb Richard W.M. Jones:
> From: "Richard W.M. Jones" <address@hidden>
>
> ---
>  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 <address@hidden>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]