]> git.kaiwu.me - haproxy.git/commitdiff
BUILD: haload: Increase a buffer size so that gcc will stop complaining master
authorOlivier Houchard <ohouchard@haproxy.com>
Wed, 8 Jul 2026 17:13:10 +0000 (19:13 +0200)
committerOlivier Houchard <cognet@ci0.org>
Wed, 8 Jul 2026 17:11:17 +0000 (19:11 +0200)
gcc 16 whines that in human_number(), the calls to snprintf() could lead
to a truncated output because the buffer is not big enough. This is not
really true, because we always have a limited number of digits, but gcc
can't figure that out, so just bump the buffer size from 5 bytes to 8
bytes to make gcc happy.

src/haload.c

index d0a644bba6a6bbad21ff0007e80542d397a712f3..6057d7978fd74ce7fcc259009a40b976e577470d 100644 (file)
@@ -477,7 +477,7 @@ static inline struct stconn *sc_new_from_hldstream(struct hldstream *hs, unsigne
  */
 static const char *human_number(double x)
 {
-       static char str[5];
+       static char str[8];
        char unit = '.';
 
        if (x < 0)