summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faulet <cfaulet@haproxy.com>2021-11-15 09:17:25 +0100
committerChristopher Faulet <cfaulet@haproxy.com>2021-11-15 09:17:27 +0100
commitb7c962b0c070a0c6ad35eaed332869a36cb931cf (patch)
tree79783c87fa989af1e02c822e2ccc3e7a5334d9a5
parentd83f6e6224fa6cfe14f58aaa50d496e097fa4f9f (diff)
downloadhaproxy-b7c962b0c070a0c6ad35eaed332869a36cb931cf.tar.gz
BUG/MINOR: stick-table/cli: Check for invalid ipv6 key
When an ipv6 key is used to filter a CLI command on a stick table (clear/set/show table ...), the return value of inet_pton() call must be checked to be sure the key is valid. This patch should fix the issue #1163. It should be backported to all supported versions.
-rw-r--r--src/stick_table.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/stick_table.c b/src/stick_table.c
index ae22b8349..331ee19a0 100644
--- a/src/stick_table.c
+++ b/src/stick_table.c
@@ -4411,7 +4411,8 @@ static int table_process_entry_per_key(struct appctx *appctx, char **args)
static_table_key.key = &uint32_key;
break;
case SMP_T_IPV6:
- inet_pton(AF_INET6, args[4], ip6_key);
+ if (inet_pton(AF_INET6, args[4], ip6_key) <= 0)
+ return cli_err(appctx, "Invalid key\n");
static_table_key.key = &ip6_key;
break;
case SMP_T_SINT: