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>
This commit is contained in:
parent
7e1d8154de
commit
bb2e894e0d
@ -221,7 +221,10 @@ static int extract_http_url (const char *url, struct request_s *request)
|
|||||||
/* Remove any surrounding '[' and ']' from IPv6 literals */
|
/* Remove any surrounding '[' and ']' from IPv6 literals */
|
||||||
p = strrchr (request->host, ']');
|
p = strrchr (request->host, ']');
|
||||||
if (p && (*(request->host) == '[')) {
|
if (p && (*(request->host) == '[')) {
|
||||||
request->host++;
|
memmove(request->host, request->host + 1,
|
||||||
|
strlen(request->host) - 2);
|
||||||
|
*p = '\0';
|
||||||
|
p--;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user