From: Kees Cook Date: Wed, 18 Dec 2013 18:00:54 +0000 (-0800) Subject: [SCSI] esas2r: fix potential format string flaw X-Git-Tag: v3.15-rc1~136^2~146 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b9c2446695cf3f98aec32e3b3f942ad1514068d2;p=thirdparty%2Fkernel%2Flinux.git [SCSI] esas2r: fix potential format string flaw This makes sure format strings cannot leak into the printk call via the constructed buffer. Signed-off-by: Kees Cook Acked-by: Bradley Grove Signed-off-by: James Bottomley --- diff --git a/drivers/scsi/esas2r/esas2r_log.c b/drivers/scsi/esas2r/esas2r_log.c index 9bf285df58ddf..a82030aa8577b 100644 --- a/drivers/scsi/esas2r/esas2r_log.c +++ b/drivers/scsi/esas2r/esas2r_log.c @@ -165,13 +165,9 @@ static int esas2r_log_master(const long level, /* * Put a line break at the end of the formatted string so that - * we don't wind up with run-on messages. only append if there - * is enough space in the buffer. + * we don't wind up with run-on messages. */ - if (strlen(event_buffer) < buflen) - strcat(buffer, "\n"); - - printk(event_buffer); + printk("%s\n", event_buffer); spin_unlock_irqrestore(&event_buffer_lock, flags); }