mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-23 01:40:12 -05:00
uri: hostname_is_localhost(): don’t crash if hostname == NULL
This commit is contained in:
parent
078f790b72
commit
1a755d0da2
2 changed files with 5 additions and 3 deletions
|
|
@ -186,6 +186,7 @@
|
||||||
_compose_ definitions.
|
_compose_ definitions.
|
||||||
* Window title not being updated while window is hidden
|
* Window title not being updated while window is hidden
|
||||||
(https://codeberg.org/dnkl/foot/issues/591).
|
(https://codeberg.org/dnkl/foot/issues/591).
|
||||||
|
* Crash on badly formatted URIs in e.g. OSC-8 URLs.
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
||||||
7
uri.c
7
uri.c
|
|
@ -270,7 +270,8 @@ hostname_is_localhost(const char *hostname)
|
||||||
if (gethostname(this_host, sizeof(this_host)) < 0)
|
if (gethostname(this_host, sizeof(this_host)) < 0)
|
||||||
this_host[0] = '\0';
|
this_host[0] = '\0';
|
||||||
|
|
||||||
return (strcmp(hostname, "") == 0 ||
|
return (hostname != NULL && (
|
||||||
strcmp(hostname, "localhost") == 0 ||
|
strcmp(hostname, "") == 0 ||
|
||||||
strcmp(hostname, this_host) == 0);
|
strcmp(hostname, "localhost") == 0 ||
|
||||||
|
strcmp(hostname, this_host) == 0));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue