Bug 58289 - [PATCH] Check arguments to udev_enumerate_new
Summary: [PATCH] Check arguments to udev_enumerate_new
Status: RESOLVED FIXED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-14 14:01 UTC by Michael Terry
Modified: 2012-12-14 14:38 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Proposed patch (893 bytes, patch)
2012-12-14 14:03 UTC, Michael Terry
Details | Splinter Review

Description Michael Terry 2012-12-14 14:01:24 UTC
udev_enumerate_new() does not check its input argument of a 'struct udev' for NULLness.

This means that arguably sloppy code like in Xorg:

    udev = udev_monitor_get_udev(udev_monitor);
    enumerate = udev_enumerate_new(udev);
    if (!enumerate)
        return;

Will have a valid (but unusable) enumerate object even if the 'udev' pointer itself is NULL.

While the Xorg code should probably also check the 'udev' pointer, I think it makes sense for libudev to not create/return a bogus enumerate object.  Plus, the other functions in libudev are pretty good about validating their input, so it would be consistent.

Patch coming.
Comment 1 Michael Terry 2012-12-14 14:03:17 UTC
Created attachment 71499 [details] [review]
Proposed patch
Comment 2 Kay Sievers 2012-12-14 14:38:06 UTC
Applied. Thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.