From d6055480175938d9d8d968db326469833cff5bf3 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 20 Nov 2019 01:10:10 -0800 Subject: Avoid a couple VLAs with constant size These are really just regular arrays masquerading as VLAs. --- local.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'local.c') diff --git a/local.c b/local.c index 6ef452b..c147259 100644 --- a/local.c +++ b/local.c @@ -165,8 +165,7 @@ size_t localUnix(int fds[], size_t cap, const char *path) { } static int recvfd(int sock) { - size_t len = CMSG_SPACE(sizeof(int)); - char buf[len]; + char buf[CMSG_SPACE(sizeof(int))]; char x; struct iovec iov = { .iov_base = &x, .iov_len = 1 }; @@ -174,7 +173,7 @@ static int recvfd(int sock) { .msg_iov = &iov, .msg_iovlen = 1, .msg_control = buf, - .msg_controllen = len, + .msg_controllen = sizeof(buf), }; if (0 > recvmsg(sock, &msg, 0)) return -1; -- cgit 1.4.1