aboutsummaryrefslogtreecommitdiff
path: root/hw/9pfs/virtio-9p-proxy.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/9pfs/virtio-9p-proxy.c')
-rw-r--r--hw/9pfs/virtio-9p-proxy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/9pfs/virtio-9p-proxy.c b/hw/9pfs/virtio-9p-proxy.c
index 6bb191ee6a..71b6198bbd 100644
--- a/hw/9pfs/virtio-9p-proxy.c
+++ b/hw/9pfs/virtio-9p-proxy.c
@@ -1100,6 +1100,10 @@ static int connect_namedsocket(const char *path)
int sockfd, size;
struct sockaddr_un helper;
+ if (strlen(path) >= sizeof(helper.sun_path)) {
+ fprintf(stderr, "Socket name too large\n");
+ return -1;
+ }
sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
if (sockfd < 0) {
fprintf(stderr, "failed to create socket: %s\n", strerror(errno));