num2str(): Fix overflow handling
authorBart Van Assche <bvanassche@acm.org>
Thu, 2 Jul 2020 21:53:09 +0000 (14:53 -0700)
committerBart Van Assche <bvanassche@acm.org>
Thu, 2 Jul 2020 22:27:39 +0000 (15:27 -0700)
commitfd99605cc5f16bc8171233ba6a8f0ab47e57c4f9
tree3611bd7abb1984177b44418441bb338368be970b
parent832a318683374475b4125cfdd5262c9c8cccb22a
num2str(): Fix overflow handling

This patch changes the output for the arguments (UINT64_MAX, 4, 1, 0,
N2S_NONE, "18.4") from "18.4(null)" into "18.4".

This patch fixes the following Coverity complaint:

CID 169307 (#1 of 1): Out-of-bounds read (OVERRUN)
27. overrun-local: Overrunning array of 6 8-byte elements at element
    index 6 (byte offset 55) by dereferencing pointer unitprefix + post_index.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
lib/num2str.c