mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -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
7
uri.c
7
uri.c
|
|
@ -270,7 +270,8 @@ hostname_is_localhost(const char *hostname)
|
|||
if (gethostname(this_host, sizeof(this_host)) < 0)
|
||||
this_host[0] = '\0';
|
||||
|
||||
return (strcmp(hostname, "") == 0 ||
|
||||
strcmp(hostname, "localhost") == 0 ||
|
||||
strcmp(hostname, this_host) == 0);
|
||||
return (hostname != NULL && (
|
||||
strcmp(hostname, "") == 0 ||
|
||||
strcmp(hostname, "localhost") == 0 ||
|
||||
strcmp(hostname, this_host) == 0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue