Bug 735042 - Coverity defects newly introduced in RHEL 6.2 (usbutils)
Summary: Coverity defects newly introduced in RHEL 6.2 (usbutils)
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: usbutils
Version: 6.2
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Lukáš Nykrýn
QA Contact: Mike Gahagan
Depends On:
Blocks: 1270825
TreeView+ depends on / blocked
Reported: 2011-09-01 09:26 UTC by Pavel Raiskup
Modified: 2016-05-10 20:52 UTC (History)
4 users (show)

Fixed In Version: usbutils-003-5.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2016-05-10 20:52:25 UTC

Attachments (Terms of Use)
Patch for issues found by coverity (2.39 KB, patch)
2011-10-24 11:01 UTC, Lukáš Nykrýn
no flags Details | Diff

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:0805 normal SHIPPED_LIVE usbutils bug fix and enhancement update 2016-05-10 22:38:27 UTC

Description Pavel Raiskup 2011-09-01 09:26:10 UTC
1) Possible static overrun

   => lsusb-t-t.c:446:

   macro SYSFS_STR() which does from

   `SYSFS_STR(d_name, bus, maxchild)` 

   something like

   `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'

   => lsusb.c:1474

   how to find error:

   a) 1040: declared 'k' (uninitialized)
   b) 1064: protocol == USB_AUDIO_CLASS_2
   c) 1068: buf[2] == 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.

Comment 3 Lukáš Nykrýn 2011-10-24 11:01:00 UTC
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.

Comment 5 Lukáš Nykrýn 2012-01-12 09:05:19 UTC
All of these patches are now in upstream git.

Comment 12 Mike Gahagan 2015-10-12 15:45:01 UTC
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.

Comment 14 Lukáš Nykrýn 2015-10-13 07:17:30 UTC
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

Comment 16 Mike Gahagan 2016-02-19 17:53:52 UTC
confirmed defects in previous Coverity runs have been fixed and Coverity runs on the current version of usbutils are clean.

Comment 18 errata-xmlrpc 2016-05-10 20:52:25 UTC
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.


Note You need to log in before you can comment on or make changes to this bug.