[Spice-devel] [spice-gtk Win32 PATCH 7/7] win-usb-dev: replace sprintf with snprintf
Uri Lublin
uril at redhat.com
Mon May 7 06:15:39 PDT 2012
---
gtk/win-usb-dev.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/gtk/win-usb-dev.c b/gtk/win-usb-dev.c
index 0a154f6..8a4f268 100644
--- a/gtk/win-usb-dev.c
+++ b/gtk/win-usb-dev.c
@@ -192,9 +192,9 @@ gboolean get_usb_dev_info(libusb_device *dev, GUdevDeviceInfo *usbdev)
return FALSE;
}
usbdev->dev = libusb_ref_device(dev);
- sprintf(usbdev->sclass, "%d", usbdev->desc.bDeviceClass);
- sprintf(usbdev->sbus, "%d", libusb_get_bus_number(dev));
- sprintf(usbdev->saddr, "%d", libusb_get_device_address(dev));
+ snprintf(usbdev->sclass, sizeof(usbdev->sclass), "%d", usbdev->desc.bDeviceClass);
+ snprintf(usbdev->sbus, sizeof(usbdev->sbus), "%d", libusb_get_bus_number(dev));
+ snprintf(usbdev->saddr, sizeof(usbdev->saddr), "%d", libusb_get_device_address(dev));
return TRUE;
}
@@ -252,6 +252,7 @@ static void handle_dev_change(GUdevClient *self)
}
leave:
+ /* keep most recent info: free previous list, and keep current list */
libusb_free_device_list(priv->dev_list, 1);
priv->dev_list = devs;
priv->dev_list_size = dev_count;
--
1.7.7.6
More information about the Spice-devel
mailing list