Re: [kees:format-security 2/3] arch/sh/kernel/dumpstack.c:118:2: error: format not a string literal and no format arguments

From: Matt Fleming
Date: Tue Mar 11 2014 - 05:59:34 EST


On Mon, 10 Mar, at 10:41:57AM, Kees Cook wrote:
> > 4e14dfc7 Matt Fleming 2009-08-07 113 /*
> > 4e14dfc7 Matt Fleming 2009-08-07 114 * Print one address/symbol entries per line.
> > 4e14dfc7 Matt Fleming 2009-08-07 115 */
> > 4e14dfc7 Matt Fleming 2009-08-07 116 static void print_trace_address(void *data, unsigned long addr, int reliable)
> > 4e14dfc7 Matt Fleming 2009-08-07 117 {
> > 4e14dfc7 Matt Fleming 2009-08-07 @118 printk(data);
>
> This needs to be "printk("%s", data);" so there is no chance of having
> "data" interpreted as a format string itself.

OMG, I suck. Thanks for the report Kees. Have you got a patch for x86?
I think that's where this code came from.

Including Andrew, because I'm not sure who else is going to take this
patch.

---