Bug 69329

Summary: Incorrect sizeof leads to allocation of more memory than needed for dbus-monitor filters
Product: dbus Reporter: Sviatoslav Chagaev <sviatoslav.chagaev>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: low Keywords: patch
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch for 1.6
Patch for 1.7

Description Sviatoslav Chagaev 2013-09-13 17:13:13 UTC

    
Comment 1 Sviatoslav Chagaev 2013-09-13 17:14:01 UTC
Created attachment 85781 [details] [review]
Patch for 1.6
Comment 2 Sviatoslav Chagaev 2013-09-13 17:14:26 UTC
Created attachment 85782 [details] [review]
Patch for 1.7
Comment 3 Simon McVittie 2013-09-16 11:44:08 UTC
Your patch is technically correct, but it should actually just be filter_len, because sizeof(char) is 1 by definition (sizeof(x) is the size of x, in chars) so there's no point in explicitly saying it. I've applied that to master.

Allocating 4 or 8 times as much memory as intended is harmless here, so I'm going to apply this to 1.7 only (1.6 is a minimally-changed stable-branch, with changes only where they fix a real bug).
Comment 4 Sviatoslav Chagaev 2013-09-16 15:27:29 UTC
(In reply to comment #3)
> Your patch is technically correct, but it should actually just be
> filter_len, because sizeof(char) is 1 by definition (sizeof(x) is the size
> of x, in chars) so there's no point in explicitly saying it. I've applied
> that to master.
> 
> Allocating 4 or 8 times as much memory as intended is harmless here, so I'm
> going to apply this to 1.7 only (1.6 is a minimally-changed stable-branch,
> with changes only where they fix a real bug).

Agreed, 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.