aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vpp/app/vppctl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/vpp/app/vppctl.c b/src/vpp/app/vppctl.c
index c9f33abf7ab..de5572d6bfa 100644
--- a/src/vpp/app/vppctl.c
+++ b/src/vpp/app/vppctl.c
@@ -192,6 +192,13 @@ main (int argc, char *argv[])
struct sockaddr_un saddr = { 0 };
saddr.sun_family = AF_UNIX;
+
+ if (strlen (sock_fname) > sizeof (saddr.sun_path) - 1)
+ {
+ perror ("socket path too long");
+ exit (1);
+ }
+
strncpy (saddr.sun_path, sock_fname, sizeof (saddr.sun_path) - 1);
sock_fd = socket (AF_UNIX, SOCK_STREAM, 0);