summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/reqs.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/reqs.c b/src/reqs.c
index 2de43a8..d762fe8 100644
--- a/src/reqs.c
+++ b/src/reqs.c
@@ -221,7 +221,10 @@ static int extract_http_url (const char *url, struct request_s *request)
/* Remove any surrounding '[' and ']' from IPv6 literals */
p = strrchr (request->host, ']');
if (p && (*(request->host) == '[')) {
- request->host++;
+ memmove(request->host, request->host + 1,
+ strlen(request->host) - 2);
+ *p = '\0';
+ p--;
*p = '\0';
}