[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] udev: Don't let strtoul parse USB busnum and devnum as octal



udevGetUintProperty was called with base set to 0 for busnum and devnum.
With base 0 strtoul parses the number as octal if it start with a 0. But
busnum and devnum are decimal and udev returns them padded with leading
zeros. So strtoul parses them as octal. This works for certain decimal
values like 001-007, but fails for values like 008.

Change udevProcessUSBDevice to use base 10 for busnum and devnum.
---
 src/node_device/node_device_udev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 734f3f7..0c0f29a 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -500,14 +500,14 @@ static int udevProcessUSBDevice(struct udev_device *device,
     if (udevGetUintProperty(device,
                             "BUSNUM",
                             &data->usb_dev.bus,
-                            0) == PROPERTY_ERROR) {
+                            10) == PROPERTY_ERROR) {
         goto out;
     }
 
     if (udevGetUintProperty(device,
                             "DEVNUM",
                             &data->usb_dev.device,
-                            0) == PROPERTY_ERROR) {
+                            10) == PROPERTY_ERROR) {
         goto out;
     }
 
-- 
1.6.3.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]