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

drivers/libusb1.c: nut_libusb_open(): do not keep Bus/Device/BusPort… #2114

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

jimklimov
Copy link
Member

@jimklimov jimklimov commented Oct 17, 2023

…pointers to random malloc() block if we did not get a number to print there from libusb(-1.0)

Avoid (un-)pretty prints like:

   0.031364     [D2] - Bus: 006
   0.031366     [D2] - Bus Port: ▒UV▒▒U
   0.031368     [D2] - Device: 001

The problem seems to be introduced only with libusb1.c, not with libusb0.c nor tools/nut-scanner/scan_usb.c (where such reports are collected differently), so can be considered a fallout of #300.

It happens when the platform can not report a useful number (so was not noticed until introduction of busport handling with #2054, but the same pattern related to earlier Bus and Device number handling too).

…pointers to random malloc() block if we did not get a number to print there from libusb

Avoid (un-)pretty prints like:
   0.031364     [D2] - Bus: 006
   0.031366     [D2] - Bus Port: ▒UV▒▒U
   0.031368     [D2] - Device: 001

Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
@jimklimov jimklimov added this to the 2.8.1 milestone Oct 17, 2023
@jimklimov jimklimov added the impacts-release-2.8.0 Issues reported against NUT release 2.8.0 (maybe vanilla or with minor packaging tweaks) label Oct 17, 2023
@jimklimov jimklimov merged commit 330a00e into networkupstools:master Oct 17, 2023
7 of 12 checks passed
@jimklimov jimklimov deleted the busport-deref branch October 17, 2023 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug impacts-release-2.8.0 Issues reported against NUT release 2.8.0 (maybe vanilla or with minor packaging tweaks) USB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant