1) Possible static overrun
macro SYSFS_STR() which does from
`SYSFS_STR(d_name, bus, maxchild)`
`read_sysfs_file_string(de_name, "speed", bus->speed, MY_SYSFS_FILENAME_LEN)`
and on the basis of MY_SYSFS_FILENAME_LEN, there is done unsafe read in
read_sysfs_file_string() on line 236 -- variable buf (bus->spped) has only
size of 6 bytes (MY_SYSFS_FILENAME_LEN has value 255).
2) Possible static overrun
=> lsusb-t.c:394 .. the same as above
3) Static overrun in dump_audiocontrol_interface()
=> lsusb.c:1466: walking through array chconfig (of size only 12 items) by
for loop with stop-value '26'.
4) Using uninitialized value as index to buffer 'buf'
how to find error:
a) 1040: declared 'k' (uninitialized)
b) 1064: protocol == USB_AUDIO_CLASS_2
c) 1068: buf == 0x09 so sub_type is assigned to 0x08
d) 1418: case 0x08:
e) 1451: case USB_AUDIO_CLASS_2:
f) 1474: printf("... ", buf[15+j+k], ..)
These problems were newly found in RHEL 6.2 by coverity difference scan on RHEL packages 6.1 → 6.2.
Created attachment 529816 [details]
Patch for issues found by coverity
Here is a patch which I have submitted to upstream. It was created against their current git, so it maybe needs few small shifts against 003 version.
All of these patches are now in upstream git.
Do we have Coverity runs for the usbutils in 6.7, I think we should use that as a starting point rather than worrying about 6.2 at this point.
Basically we just need backport these patches from upstream:
05c92e6 Buffer overun
4c02560 Wrong shifting of bmMPEGFeatures byte
c04e55c Possible resource leak
e8a312a Using uninitialized value as index
c706f0d Reading 26 item in array with size 12.
f79916b Possible buffer overflow when using SYSFS_STR
confirmed defects in previous Coverity runs have been fixed and Coverity runs on the current version of usbutils are clean.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.