[PATCH v5 1/2] selinux: add brief info to policydb

William Roberts bill.c.roberts at gmail.com
Wed May 17 15:09:46 UTC 2017


On Wed, May 17, 2017 at 7:59 AM, Sebastien Buisson
<sbuisson.ddn at gmail.com> wrote:
> 2017-05-16 22:40 GMT+02:00 Stephen Smalley <sds at tycho.nsa.gov>:
>>> +     strcpy(*brief, policydb.policybrief);
>>> +     /* *len is the length of the output string */
>>> +     *len = policybrief_len - 1;
>>
>> Is there a particular reason to not just return policybrief_len here as
>> well, for consistency in the interface?  How do you intend to use this
>> value in the caller?
>
> As called in the other patch to expose policy brief via selinuxfs
> (sel_read_policybrief), the intent is to provide the caller with the
> length of the string returned.
> Or should I set *len to policy brief_len here, and just make the
> caller aware that the returned length is in fact the length of the
> buffer (i.e. including terminating NUL byte)?

What is the caller supposed to do with length? This interface seemed kind of
odd. If it's guaranteed NUL byte terminated, do they even need length?
--
To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the Linux-security-module-archive mailing list