From patchwork Fri Apr 19 11:34:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 237920 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id AB03B2C01B4 for ; Fri, 19 Apr 2013 21:37:12 +1000 (EST) Received: from localhost ([::1]:48766 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT9cs-0001dS-Sr for incoming@patchwork.ozlabs.org; Fri, 19 Apr 2013 07:37:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT9aF-0006qS-IP for qemu-devel@nongnu.org; Fri, 19 Apr 2013 07:34:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UT9aB-0003Qu-7R for qemu-devel@nongnu.org; Fri, 19 Apr 2013 07:34:27 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34459) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UT9aA-0003Ql-U0 for qemu-devel@nongnu.org; Fri, 19 Apr 2013 07:34:23 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3JBYMHl007121 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 19 Apr 2013 07:34:22 -0400 Received: from localhost (ovpn-112-20.ams2.redhat.com [10.36.112.20]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r3JBYLQK021658; Fri, 19 Apr 2013 07:34:21 -0400 From: Stefan Hajnoczi To: Date: Fri, 19 Apr 2013 13:34:00 +0200 Message-Id: <1366371241-23430-8-git-send-email-stefanha@redhat.com> In-Reply-To: <1366371241-23430-1-git-send-email-stefanha@redhat.com> References: <1366371241-23430-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , "Richard W.M. Jones" , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 7/8] ssh: Remove unnecessary use of strlen function. X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: "Richard W.M. Jones" Reviewed-by: Eric Blake Reviewed-by: Stefan Weil Signed-off-by: Stefan Hajnoczi --- 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); }