From 19e08de0e2d498dc1b8a7fdedffd599420f1d778 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Fri, 3 Jun 2016 12:12:24 -0300 Subject: [PATCH] use memchr instead of strchr for checking if host is ipv6 --- core/net/http-socket/http-socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/net/http-socket/http-socket.c b/core/net/http-socket/http-socket.c index ddcebaec1..4d78cc276 100644 --- a/core/net/http-socket/http-socket.c +++ b/core/net/http-socket/http-socket.c @@ -419,11 +419,11 @@ event(struct tcp_socket *tcps, void *ptr, tcp_socket_send_str(tcps, "Host: "); /* If we have IPv6 host, add the '[' and the ']' characters to the host. As in rfc2732. */ - if (strchr(host, ':')) { + if (memchr(host, ':', MAX_HOSTLEN)) { tcp_socket_send_str(tcps, "["); } tcp_socket_send_str(tcps, host); - if (strchr(host, ':')) { + if (memchr(host, ':', MAX_HOSTLEN)) { tcp_socket_send_str(tcps, "]"); } tcp_socket_send_str(tcps, "\r\n");