aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-08-16 12:37:24 +0200
committerDamjan Marion <damarion@cisco.com>2016-08-16 12:37:24 +0200
commita290d7c4f50270387e90091524e307c4dea88bd5 (patch)
tree45cc241cd82fc61bb8b1b89cc83f5f3d05c11267
parente70dcc8676b6b2db74989e43f116bbb200239bf8 (diff)
Fix coverity issues in vhost-user code, fixes VPP-189
Change-Id: Ief95aac5d4451f411dbed8050528708c0b1b7732 Signed-off-by: Damjan Marion <damarion@cisco.com>
-rw-r--r--vnet/vnet/devices/virtio/vhost-user.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/vnet/vnet/devices/virtio/vhost-user.c b/vnet/vnet/devices/virtio/vhost-user.c
index 7dc7d0ebadf..dca60f14c67 100644
--- a/vnet/vnet/devices/virtio/vhost-user.c
+++ b/vnet/vnet/devices/virtio/vhost-user.c
@@ -296,6 +296,9 @@ static clib_error_t * vhost_user_socket_read (unix_file_t * uf)
memset(&mh, 0, sizeof(mh));
memset(control, 0, sizeof(control));
+ for (i=0; i < VHOST_MEMORY_MAX_NREGIONS; i++)
+ fds[i] = -1;
+
/* set the payload */
iov[0].iov_base = (void *) &msg;
iov[0].iov_len = VHOST_USER_MSG_HDR_SZ;
@@ -1498,7 +1501,7 @@ static int vhost_user_init_server_sock(const char * sock_filename, int *sockfd)
}
un.sun_family = AF_UNIX;
- strcpy((char *) un.sun_path, (char *) sock_filename);
+ strncpy((char *) un.sun_path, (char *) sock_filename, sizeof(un.sun_path) - 1);
/* remove if exists */
unlink( (char *) sock_filename);