From: Daniel Stenberg Date: Wed, 13 Feb 2019 12:20:41 +0000 (+0100) Subject: strip_trailing_dot: make sure NULL is never used for strlen X-Git-Tag: curl-7_64_1~133 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=354aa32820914cc95a0a23ce1fc27d2abe1be065;p=thirdparty%2Fcurl.git strip_trailing_dot: make sure NULL is never used for strlen scan-build warning: Null pointer passed as an argument to a 'nonnull' parameter --- diff --git a/lib/url.c b/lib/url.c index 46c8fb5fb1..3358899037 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;