summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-02-13 13:20:41 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-02-14 23:30:43 +0100
commit354aa32820914cc95a0a23ce1fc27d2abe1be065 (patch)
tree11c6059db456f3e6a72daecf45916be1a0696be8
parent4015fae044ce52a639c9358e22a9e948f287c89f (diff)
downloadcurl-354aa32820914cc95a0a23ce1fc27d2abe1be065.tar.gz
strip_trailing_dot: make sure NULL is never used for strlen
scan-build warning: Null pointer passed as an argument to a 'nonnull' parameter
-rw-r--r--lib/url.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 46c8fb5fb..335889903 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1686,6 +1686,8 @@ static bool is_ASCII_name(const char *hostname)
static void strip_trailing_dot(struct hostname *host)
{
size_t len;
+ if(!host || !host->name)
+ return;
len = strlen(host->name);
if(len && (host->name[len-1] == '.'))
host->name[len-1] = 0;