diff options
author | Michael Adam <obnox@samba.org> | 2013-11-16 13:07:19 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2013-11-16 13:07:19 +0100 |
commit | bb2e894e0dd7cafb730ea56496dbc43997f6c98e (patch) | |
tree | 7f74af0923a96baea055376471ff192ad6f25a59 | |
parent | 7e1d8154dee83b828d8e410f0ef96fae1d1ed815 (diff) |
BB#116: fix invalid free when connecting to ipv6 literal address
When removing the '[' and ']' characers from the ipv6 literal address, make sure
the pointer that is later free'd stays a malloced pointer by memmoving the
string one place left.
Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r-- | src/reqs.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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'; } |