mirror of
https://github.com/yrutschle/sslh.git
synced 2026-10-22 18:12:10 +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:
1 parent
c179d9a57b
commit
5cf591a254
1 file changed
+1
@@ -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 */
|
||||
|
||||
Reference in new issue
Block a user