lkml.org 
[lkml]   [2015]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] staging: fbtft: fix out of bound access
From
Date
On Thu, 2015-06-04 at 17:12 +0530, Sudip Mukherjee wrote:
> size of str is 16, but in snprintf the size was mentioned as 128.
[]
> diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
[]
> @@ -1096,7 +1096,7 @@ static int fbtft_init_display_dt(struct fbtft_par *par)
> /* make debug message */
> msg[0] = '\0';
> for (j = 0; j < i; j++) {
> - snprintf(str, 128, " %02X", buf[j]);
> + snprintf(str, 16, " %02X", buf[j]);

using sizeof(str) is probably more robust

msg isn't big enough to hold the maximum possible output.

If this is really useful, and I rather doubt it is,
it'd probably be better to use a loop to output
multiple lines, one for each register.




\
 
 \ /
  Last update: 2015-06-04 14:21    [W:0.646 / U:0.280 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site