misc: fix coverity warnings 56/34956/2
authorDave Barach <dave@barachs.net>
Tue, 18 Jan 2022 13:52:47 +0000 (08:52 -0500)
committerMatthew Smith <mgsmith@netgate.com>
Tue, 18 Jan 2022 15:28:28 +0000 (15:28 +0000)
Type: fix

Signed-off-by: Dave Barach <dave@barachs.net>
Change-Id: I8ea0193ebb2a721a0582451ffd64c4063ac6d233

src/vnet/interface_cli.c
src/vpp/app/vppctl.c

index b6d3857..a2dfc2b 100644 (file)
@@ -2515,6 +2515,12 @@ set_interface_tx_hash_cmd (vlib_main_t *vm, unformat_input_t *input,
       goto error;
     }
 
+  if (hash_name == 0)
+    {
+      error = clib_error_return (0, "hash-name is required");
+      goto error;
+    }
+
   hi = vnet_get_hw_interface (vnm, hw_if_index);
   ftype =
     vnet_get_hw_interface_class (vnm, hi->hw_class_index)->tx_hash_fn_type;
index becab52..c9f33ab 100644 (file)
@@ -192,7 +192,7 @@ main (int argc, char *argv[])
 
   struct sockaddr_un saddr = { 0 };
   saddr.sun_family = AF_UNIX;
-  strncpy (saddr.sun_path, sock_fname, sizeof (saddr.sun_path));
+  strncpy (saddr.sun_path, sock_fname, sizeof (saddr.sun_path) - 1);
 
   sock_fd = socket (AF_UNIX, SOCK_STREAM, 0);
   if (sock_fd < 0)