[apparmor] [PATCH 1/3] Generate the features list from the features directory

John Johansen john.johansen at canonical.com
Fri Feb 24 00:26:42 UTC 2012


On 02/23/2012 04:03 PM, Kees Cook wrote:
> On Thu, Feb 23, 2012 at 02:33:18PM -0800, John Johansen wrote:
>> +char *snprintf_buffer(char *buf, char *pos, ssize_t size, const char *fmt, ...)
> 
> I think size should be "size_t" rather than "ssize_t".
> 
>> +{
>> +	va_list args;
>> +	int i, remaining = size - (pos - buf);
> 
> remaining should be size_t.
> 
>> +
>> +	va_start(args, fmt);
>> +	i = vsnprintf(pos, remaining, fmt, args);
>> +	va_end(args);
>> +
>> +	if (i >= size) {
> 
> This should check against remaining, rather than size.
> 
> (I wonder if we should just use glib for its file and string handling functions...)
> 
no. What I have started doing is converting the whole thing to C++, as we are already
using it in the backend.  The first pass will be just what is necessary to get it to
build, and then different parts will get replaced.

So this will get cleaned up, but there will still be some ugliness for a bit




More information about the AppArmor mailing list