Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1158490 > unrolled thread
| Started by | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| First post | 2015-06-04 13:50 +0200 |
| Last post | 2015-06-04 14:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] staging: fbtft: fix out of bound access Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-06-04 13:50 +0200
Re: [PATCH] staging: fbtft: fix out of bound access Joe Perches <joe@perches.com> - 2015-06-04 14:20 +0200
| From | Sudip Mukherjee <sudipm.mukherjee@gmail.com> |
|---|---|
| Date | 2015-06-04 13:50 +0200 |
| Subject | [PATCH] staging: fbtft: fix out of bound access |
| Message-ID | <pxBON-8al-5@gated-at.bofh.it> |
size of str is 16, but in snprintf the size was mentioned as 128.
Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
---
drivers/staging/fbtft/fbtft-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index ce64521..0af84b5 100644
--- 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]);
strcat(msg, str);
}
fbtft_par_dbg(DEBUG_INIT_DISPLAY, par,
--
1.8.1.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2015-06-04 14:20 +0200 |
| Message-ID | <pxChR-xc-23@gated-at.bofh.it> |
| In reply to | #1158490 |
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web