Re: [patch] kernel events layer
From: Dan Aloni
Date: Fri Jul 23 2004 - 16:33:02 EST
On Fri, Jul 23, 2004 at 01:41:57PM -0400, Robert Love wrote:
> +void send_kmessage(int type, const char *object, const char *signal,
> + const char *fmt, ...)
> +{
> + char *buffer;
> + int len;
> + int ret;
> +
> + if (!object)
> + return;
> +
> + if (!signal)
> + return;
> +
> + if (strlen(object) > PAGE_SIZE)
> + return;
> +
> + buffer = (char *) get_zeroed_page(GFP_ATOMIC);
> + if (!buffer)
> + return;
> +
> + len = sprintf(buffer, "From: %s\n", object);
> + len += sprintf(&buffer[len], "Signal: %s\n", signal);
IMHO you either should not assume anything about the length of the object
string, _or_ do the complete safe string assembly e.g:
len += snprintf(buffer, PAGE_SIZE, "From: %s\nSignal: %s\n",
object, signal);
--
Dan Aloni
da-x@xxxxxxxxxxx
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/