]> granicus.if.org Git - curl/commitdiff
strip_trailing_dot: make sure NULL is never used for strlen
authorDaniel Stenberg <daniel@haxx.se>
Wed, 13 Feb 2019 12:20:41 +0000 (13:20 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 14 Feb 2019 22:30:43 +0000 (23:30 +0100)
scan-build warning: Null pointer passed as an argument to a 'nonnull'
parameter

lib/url.c

index 46c8fb5fb1cac7b6ef4371959232bb1558ca6b04..3358899037f419db5798bd46915add705b8cb449 100644 (file)
--- 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;