From patchwork Thu Jan 10 13:33:25 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/3] usb-host: Initialize dev->port the obviously safe way Date: Thu, 10 Jan 2013 03:33:25 -0000 From: Markus Armbruster X-Patchwork-Id: 211004 Message-Id: <1357824805-31574-4-git-send-email-armbru@redhat.com> To: qemu-devel@nongnu.org Cc: kraxel@redhat.com 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 --- 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 ea2179f..fc7c5ca 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 */