Re: [PATCH 0/2] vsprintf: ignore %n again

From: George Spelvin
Date: Wed Sep 18 2013 - 11:23:24 EST


> +#define printk(fmt, ...) do { \
> + compiletime_assert(__builtin_constant_p(fmt), \
> + "Non-constant format string"); \
> + printk(fmt, ##__VA_ARGS__); \
> +} while (0)

May I recommend __builtin_constant_p(*fmt). Since:

char buf[OVERFLOW_VULNERABILITY];
strcpy(buf, malicious_format);
printk(buf, args)

has __builtin_constant_p(buf), but it's not a constant format string.
--
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/