summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2018-09-07 07:19:34 -0700
committerBart Van Assche <bvanassche@acm.org>2018-09-07 07:29:35 -0700
commitd0b2501a379dcf25cfcfe7059e9dc54b9c5ada4f (patch)
tree6b9728aef034f529e14f0c7c6e64ac65cb00552b /lib
parent3b6879b271835dabefbe7bc626cb24ecb96547c1 (diff)
downloadfio-d0b2501a379dcf25cfcfe7059e9dc54b9c5ada4f.tar.gz
fio-d0b2501a379dcf25cfcfe7059e9dc54b9c5ada4f.tar.bz2
num2str(): Avoid an out-of-bounds array access
This patch fixes Coverity ID 169307. Fixes: 1ec3d69b0ed8 ("Implement a better num2str()") Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/num2str.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/num2str.c b/lib/num2str.c
index ff8a365b..1abe22f3 100644
--- 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;