[apparmor] [PATCH 1/3] Generate the features list from the features directory
Kees Cook
kees at ubuntu.com
Fri Feb 24 00:03:53 UTC 2012
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...)
-Kees
--
Kees Cook
More information about the AppArmor
mailing list