Bug 58289

Summary: [PATCH] Check arguments to udev_enumerate_new
Product: systemd Reporter: Michael Terry <michael.terry>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Proposed patch

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.