[apparmor] linux-4.5/security/apparmor/match.c:64: possible copying of uninit fields ?

John Johansen john.johansen at canonical.com
Tue Mar 15 11:59:04 UTC 2016


On 03/15/2016 04:45 AM, Ben Hutchings wrote:
> On Tue, 2016-03-15 at 11:02 +0000, David Binderman wrote:
>> Hello there,
>>
>> [linux-4.5/security/apparmor/match.c:64]: (error) Uninitialized struct member: th.td_hilen
>> [linux-4.5/security/apparmor/match.c:64]: (error) Uninitialized struct member: th.td_data
>>
>> Source code is
>>
>>        *table = th;
>>
>> It looks to me like local struct th has only been partly initialised.
> [...]
> 
> Yes, but:
> 
> - td_hilen is, AFAICS, completely unused in this version of AppArmor
>  
> (so should presumably be removed from the struct definition)
> - td_data
> has zero size, so this warning seems incorrect
> 

Indeed, td_hilen is unused atm so it isn't a vulnerability but I wouldn't
say the warning is bad. Basically the warning is pointing out something
that needs to be addressed.

I have a patch that I haven't pushed yet (it needs a little more testing
and review) that takes a different approach. Basically I rewrote the unpack
so that the internal representation uses a struct without the unused
elements, but we keep the old struct for the unpack (only used on the
input stream). If you are interested I can reply here with the pending
patch (its rather large) otherwise, it can wait a bit for a few more unit
tests to be written for and review by the other apparmor devs.

Of course I am not opposed to pushing a simpler fix to get rid of this
warning until the larger patch can land.

 




More information about the AppArmor mailing list