diff --git a/src/http_fetch.c b/src/http_fetch.c index b501ab096..b030509d5 100644 --- a/src/http_fetch.c +++ b/src/http_fetch.c @@ -1100,7 +1100,7 @@ static int smp_fetch_hdr_ip(const struct arg *args, struct sample *smp, const ch /* IPv4 address suffixed with ':' followed by a valid port number */ smp->data.type = SMP_T_IPV4; break; - } else if (temp->area[0] == '[' && temp->area[smp->data.u.str.data-1] == ']') { + } else if (smp->data.u.str.data >= 2 && temp->area[0] == '[' && temp->area[smp->data.u.str.data-1] == ']') { /* IPv6 address enclosed in square brackets */ temp->area[smp->data.u.str.data-1] = '\0'; if (inet_pton(AF_INET6, temp->area+1, &smp->data.u.ipv6)) {