[apparmor] [patch] parser - add support for variable expansion in dbus rules v2

Tyler Hicks tyhicks at canonical.com
Thu Sep 5 00:08:56 UTC 2013


On 2013-08-29 11:40:08, Tyler Hicks wrote:
> On 2013-08-29 10:50:35, Steve Beattie wrote:
> >  
> > +#define DUP_STRING(orig, new, field) \
> > +	(new)->field = (orig)->field ? strdup((orig)->field) : NULL
> > +
> > +struct dbus_entry *dup_dbus_entry(struct dbus_entry *orig)
> > +{
> > +	struct dbus_entry *ent = NULL;
> > +	ent = (struct dbus_entry *) calloc(1, sizeof(struct dbus_entry));
> > +	if (!ent)
> > +		return NULL;
> > +
> > +	DUP_STRING(orig, ent, bus);
> > +	DUP_STRING(orig, ent, name);
> > +	DUP_STRING(orig, ent, peer_label);
> > +	DUP_STRING(orig, ent, path);
> > +	DUP_STRING(orig, ent, interface);
> > +	DUP_STRING(orig, ent, member);
> 
> There should be error checking on these strdup()'s. Otherwise, ent could
> be returned with NULL pointers in fields where orig didn't have any.
> 
> > +	ent->mode = orig->mode;
> > +	ent->audit = orig->audit;
> > +	ent->deny = orig->deny;
> > +
> > +	ent->next = orig->next;
> > +
> > +	return ent;
> > +}

I noticed that the DUP_STRING() issue I mentioned above is unaddressed
in trunk. I still think it needs to be fixed. Thoughts?

Tyler
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20130904/7b250b6e/attachment.pgp>


More information about the AppArmor mailing list