]> git.puffer.fish Git - matthieu/frr.git/commitdiff
vtysh: Fix Coverity Warning CID 1399479 (#1 of 1): Destination buffer too small ...
authorMartin Winter <mwinter@opensourcerouting.org>
Fri, 10 Feb 2017 09:51:57 +0000 (16:51 +0700)
committerMartin Winter <mwinter@opensourcerouting.org>
Fri, 10 Feb 2017 09:51:57 +0000 (16:51 +0700)
Coverity: buffer_size: You might overrun the 108 byte destination string addr.sun_path by writing the maximum 4095 bytes from path.
Signed-off-by: Martin Winter <mwinter@opensourcerouting.org>
vtysh/vtysh.c

index 7546b4ddb0a526fe0658642422d89bd101835d1e..1b0dd8cd29210313393fb8a7637fc22e54d96dd8 100644 (file)
@@ -3001,7 +3001,7 @@ vtysh_connect (struct vtysh_client *vclient)
 
   memset (&addr, 0, sizeof (struct sockaddr_un));
   addr.sun_family = AF_UNIX;
-  strncpy (addr.sun_path, path, strlen (path));
+  strlcpy (addr.sun_path, path, sizeof (addr.sun_path));
 #ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
   len = addr.sun_len = SUN_LEN(&addr);
 #else