projects
/
fio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
3b6879b
)
num2str(): Avoid an out-of-bounds array access
author
Bart Van Assche
<bvanassche@acm.org>
Fri, 7 Sep 2018 14:19:34 +0000
(07:19 -0700)
committer
Bart Van Assche
<bvanassche@acm.org>
Fri, 7 Sep 2018 14:29:35 +0000
(07:29 -0700)
This patch fixes Coverity ID 169307.
Fixes:
1ec3d69b0ed8
("Implement a better num2str()")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
lib/num2str.c
patch
|
blob
|
blame
|
history
diff --git
a/lib/num2str.c
b/lib/num2str.c
index ff8a365bcaed516e07c69aac91f96e73952faa2b..1abe22f33794c0ccf6b724e74aef7a1f62271166 100644
(file)
--- a/
lib/num2str.c
+++ b/
lib/num2str.c
@@
-72,7
+72,7
@@
char *num2str(uint64_t num, int maxlen, int base, int pow2, enum n2s_unit units)
* Divide by K/Ki until string length of num <= maxlen.
*/
modulo = -1U;
- while (post_index <
sizeof
(sistr)) {
+ while (post_index <
ARRAY_SIZE
(sistr)) {
sprintf(tmp, "%llu", (unsigned long long) num);
if (strlen(tmp) <= maxlen)
break;