]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: parse: check the validity of size string in a more strict way
authorGodbach <nylzhaowei@gmail.com>
Wed, 28 Jan 2015 09:36:16 +0000 (17:36 +0800)
committerWilly Tarreau <w@1wt.eu>
Wed, 28 Jan 2015 10:23:11 +0000 (11:23 +0100)
If a stick table is defined as below:
stick-table type ip size 50ka expire 300s

HAProxy will stop parsing size after passing through "50k" and return the value
directly. But such format string of size should not be valid. The patch checks
the next character to report error if any.

Signed-off-by: Godbach <nylzhaowei@gmail.com>
src/standard.c

index 93c44bb3ce5dbc11968a73b54823bb87443df014..f28825f827acba11f2e392189c88cfd770deecf4 100644 (file)
@@ -1656,6 +1656,9 @@ const char *parse_size_err(const char *text, unsigned *ret) {
                return text;
        }
 
+       if (*text != '\0' && *++text != '\0')
+               return text;
+
        *ret = value;
        return NULL;
 }