misc: fix sonarclound warnings 75/27575/4
authorDave Barach <dave@barachs.net>
Tue, 16 Jun 2020 12:40:53 +0000 (08:40 -0400)
committerDave Wallace <dwallacelf@gmail.com>
Tue, 16 Jun 2020 17:32:17 +0000 (17:32 +0000)
Type: fix
Ticket: VPP-1888
Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I9c2fb926a5e010658088a74051c8c3462ff61734

src/plugins/acl/acl_test.c
src/plugins/dns/dns_test.c
src/plugins/http_static/static_server.c

index e559f3a..c139b32 100644 (file)
@@ -615,10 +615,13 @@ api_acl_add_replace_from_file (vat_main_t * vam)
          break;
       }
 
+    if (file_name == NULL)
+        goto done;
+
     fd = open(file_name, O_RDONLY);
     if (fd < 0)
       {
-        clib_warning("Could not open file '%s'");
+        clib_warning("Could not open file '%s'", file_name);
         goto done;
       }
 
index 9d5be8f..aefcefb 100644 (file)
@@ -123,6 +123,12 @@ api_dns_resolve_name (vat_main_t * vam)
        break;
     }
 
+  if (name == 0)
+    {
+      errmsg ("missing name to resolve");
+      return -99;
+    }
+
   if (vec_len (name) > 127)
     {
       errmsg ("name too long");
index d7a7fcf..45d8731 100644 (file)
@@ -937,7 +937,7 @@ state_sent_ok (session_t * s, http_session_t * hs,
 
   /* What kind of dog food are we serving? */
   suffix = (char *) (hs->path + vec_len (hs->path) - 1);
-  while (*suffix != '.')
+  while ((u8 *) suffix >= hs->path && *suffix != '.')
     suffix--;
   suffix++;
   http_type = "text/html";