aboutsummaryrefslogtreecommitdiff
path: root/uri.c
diff options
context:
space:
mode:
Diffstat (limited to 'uri.c')
-rw-r--r--uri.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/uri.c b/uri.c
index 51cd8093..e747991d 100644
--- a/uri.c
+++ b/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));
}