mirror of
https://github.com/yrutschle/sslh.git
synced 2025-04-13 23:57:14 +03:00
Avoid segfault with malformed IPv6 address
A literal IPv6 address without a trailing bracket will result in a write past the end of the address buffer: ~~~ segfault.conf protocols: ( { name: "tls"; host: "["; port: "8443"; } ); ~~~ ~~~ $ sslh-select -p 127.0.0.1:443 --foreground -F./segfault.conf [: no closing bracket in IPv6 address? Segmentation fault (core dumped) ~~~
This commit is contained in:
parent
c179d9a57b
commit
5cf591a254
1
common.c
1
common.c
@ -496,6 +496,7 @@ int resolve_split_name(struct addrinfo **out, const char* ct_host, const char* s
|
||||
end = strrchr(host, ']');
|
||||
if (!end) {
|
||||
fprintf(stderr, "%s: no closing bracket in IPv6 address?\n", host);
|
||||
return -1;
|
||||
}
|
||||
host++; /* skip first bracket */
|
||||
*end = 0; /* remove last bracket */
|
||||
|
Loading…
x
Reference in New Issue
Block a user