projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8ef7479
)
bcache: Fix a format string overflow
author
Kent Overstreet
<koverstreet@google.com>
Fri, 5 Apr 2013 21:12:28 +0000
(14:12 -0700)
committer
Kent Overstreet
<koverstreet@google.com>
Mon, 8 Apr 2013 20:33:49 +0000
(13:33 -0700)
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Kent Overstreet <koverstreet@google.com>
drivers/md/bcache/util.c
patch
|
blob
|
history
diff --git
a/drivers/md/bcache/util.c
b/drivers/md/bcache/util.c
index
a9619d8
..
da3a99e
100644
(file)
--- a/
drivers/md/bcache/util.c
+++ b/
drivers/md/bcache/util.c
@@
-76,7
+76,7
@@
STRTO_H(strtoull, unsigned long long)
ssize_t bch_hprint(char *buf, int64_t v)
{
static const char units[] = "?kMGTPEZY";
- char dec[
3
] = "";
+ char dec[
4
] = "";
int u, t = 0;
for (u = 0; v >= 1024 || v <= -1024; u++) {
@@
-88,7
+88,7
@@
ssize_t bch_hprint(char *buf, int64_t v)
return sprintf(buf, "%llu", v);
if (v < 100 && v > -100)
- s
printf(dec
, ".%i", t / 100);
+ s
nprintf(dec, sizeof(dec)
, ".%i", t / 100);
return sprintf(buf, "%lli%s%c", v, dec, units[u]);
}