]> git.proxmox.com Git - qemu.git/commitdiff
usb-host: Initialize dev->port the obviously safe way
authorMarkus Armbruster <armbru@redhat.com>
Thu, 10 Jan 2013 13:33:25 +0000 (14:33 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 14 Jan 2013 11:47:11 +0000 (12:47 +0100)
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 <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/host-linux.c

index a498840e0a2d5ca6f60ca9769ad076c90df42e40..ad75ce0702a25c58ecd20c5c6e9f8e881930b2f2 100644 (file)
@@ -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 */