提交 33e25a39 编写于 作者: M Matthias Bolte

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.
上级 c16888a8
...@@ -500,14 +500,14 @@ static int udevProcessUSBDevice(struct udev_device *device, ...@@ -500,14 +500,14 @@ static int udevProcessUSBDevice(struct udev_device *device,
if (udevGetUintProperty(device, if (udevGetUintProperty(device,
"BUSNUM", "BUSNUM",
&data->usb_dev.bus, &data->usb_dev.bus,
0) == PROPERTY_ERROR) { 10) == PROPERTY_ERROR) {
goto out; goto out;
} }
if (udevGetUintProperty(device, if (udevGetUintProperty(device,
"DEVNUM", "DEVNUM",
&data->usb_dev.device, &data->usb_dev.device,
0) == PROPERTY_ERROR) { 10) == PROPERTY_ERROR) {
goto out; goto out;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册