]> git.kaiwu.me - haproxy.git/commitdiff
BUG/MINOR: tools: fix invalid character detection in strl2ic()
authorHuangbin Zhan <zhanhb88@gmail.com>
Thu, 2 Jul 2026 13:56:48 +0000 (09:56 -0400)
committerOlivier Houchard <cognet@ci0.org>
Thu, 2 Jul 2026 14:02:49 +0000 (16:02 +0200)
ASCII characters with a value smaller than '0' were not properly
detected as invalid characters, leading to incorrect behavior. The
strl2irc() and strl2llrc() functions are not impacted because this
situation is detected by their overflow checks.

Fixes Github issue #3357.

src/tools.c

index 6c3dce7c9e857b2246e4a4b7aae93c9652a0cb18..5b15905a87c0299b6dce473ecb5b6159683c0abd 100644 (file)
@@ -2584,8 +2584,8 @@ long long int read_int64(const char **s, const char *end)
  */
 int strl2ic(const char *s, int len)
 {
-       int i = 0;
-       int j, k;
+       int i = 0, k;
+       unsigned int j;
 
        if (len > 0) {
                if (*s != '-') {