lkml.org 
[lkml]   [2013]   [Dec]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RESEND][PATCH] scsi: esas2r: fix potential format string flaw
From
Date
On Tue, 2013-12-17 at 10:27 -0800, Kees Cook wrote:
> This makes sure format strings cannot leak into the printk call via the
> constructed buffer.
[]
> diff --git a/drivers/scsi/esas2r/esas2r_log.c b/drivers/scsi/esas2r/esas2r_log.c
[]
> @@ -171,7 +171,7 @@ static int esas2r_log_master(const long level,
> if (strlen(event_buffer) < buflen)
> strcat(buffer, "\n");
>
> - printk(event_buffer);
> + printk("%s", event_buffer);

It's probably better to remove the

if (strlen(event_buffer) < buflen)
strcat(buffer, "\n");

and use

printk("%s\n", event_buffer);

so that the output is always newline terminated.




\
 
 \ /
  Last update: 2013-12-18 07:01    [W:0.067 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site