From patchwork Mon Jan 14 11:50:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 211771 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 539922C00A2 for ; Mon, 14 Jan 2013 22:51:28 +1100 (EST) Received: from localhost ([::1]:56385 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiZY-0001UI-90 for incoming@patchwork.ozlabs.org; Mon, 14 Jan 2013 06:51:24 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38486) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiYz-0000H1-6k for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:50:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuiYr-0004EQ-Va for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:50:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:1293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuiYr-0004EB-Ns for qemu-devel@nongnu.org; Mon, 14 Jan 2013 06:50:41 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0EBoeY5026805 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 14 Jan 2013 06:50:41 -0500 Received: from rincewind.home.kraxel.org (ovpn-116-52.ams2.redhat.com [10.36.116.52]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0EBoXVw030885; Mon, 14 Jan 2013 06:50:33 -0500 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 8720141C36; Mon, 14 Jan 2013 12:50:19 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Mon, 14 Jan 2013 12:50:19 +0100 Message-Id: <1358164219-14070-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1358164219-14070-1-git-send-email-kraxel@redhat.com> References: <1358164219-14070-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Markus Armbruster , Gerd Hoffmann Subject: [Qemu-devel] [PATCH 6/6] usb-host: Initialize dev->port the obviously safe way 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: Markus Armbruster Coverity worries the strcpy() could overrun the destination. It can't, because the source always points to usb_host_scan()'s auto port[], which has the same size. Use pstrcpy() anyway, to hush the checker. Signed-off-by: Markus Armbruster Signed-off-by: Gerd Hoffmann --- hw/usb/host-linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c index a498840..ad75ce0 100644 --- a/hw/usb/host-linux.c +++ b/hw/usb/host-linux.c @@ -1314,7 +1314,7 @@ static int usb_host_open(USBHostDevice *dev, int bus_num, dev->bus_num = bus_num; dev->addr = addr; - strcpy(dev->port, port); + pstrcpy(dev->port, sizeof(dev->port), port); dev->fd = fd; /* read the device description */