Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device number fixes #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

szeder
Copy link

@szeder szeder commented Oct 3, 2021

Fix a bug which likely parses the device number in the argument of the -d option as an octal number, and correct the syntax of the -d option's argument in the help text and the documentation.

The USB device number given as argument to the '-d' option is parsed
with a strtol() call with 0 base.  This is an issue with USB device
numbers that start with a 0 (and they do tend to start with a 0, e.g.
from lsusb output: "Bus 001 Device 014"), because strtol() with 0 base
interprets them as an octal number.  Consequently, the program might not
find the device, or, worse, might find and operate on the wrong device.

Fix this by explicitly specifying base 10 to the strtol() call
converting the device number.

All other strtol() calls already explicitly specify a 10 or 16 base.
For the '-d' option the code expects the bus and device numbers in the
format "bus.dev", i.e. separated by a dot, but the documentation and
help text mention "bus:dev", i.e.  separated by a colon.

Update all documentation and help text to match the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant