summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-07-29 20:56:12 -0400
committerJune McEnroe <june@causal.agency>2018-07-29 20:56:12 -0400
commit23be20872761de1f0c673b875ee43ac60ed76d37 (patch)
tree90636a76211e7be45ed804361c0acfcd7e20f2f7 /bin
parentFix cfmakeraw calls (diff)
downloadsrc-23be20872761de1f0c673b875ee43ac60ed76d37.tar.gz
src-23be20872761de1f0c673b875ee43ac60ed76d37.zip
Fix dtch cmsg size
Apparently you actually need CMSG_SPACE and not just CMSG_LEN... Well
done, everyone.
Diffstat (limited to 'bin')
-rw-r--r--bin/dtch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bin/dtch.c b/bin/dtch.c
index a0cd2899..6466c3be 100644
--- a/bin/dtch.c
+++ b/bin/dtch.c
@@ -56,7 +56,7 @@ static char z;
 static struct iovec iov = { .iov_base = &z, .iov_len = 1 };
 
 static ssize_t sendFd(int sock, int fd) {
-	size_t size = CMSG_LEN(sizeof(int));
+	size_t size = CMSG_SPACE(sizeof(int));
 	char buf[size];
 	struct msghdr msg = {
 		.msg_iov = &iov,
@@ -66,7 +66,7 @@ static ssize_t sendFd(int sock, int fd) {
 	};
 
 	struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msg);
-	cmsg->cmsg_len = size;
+	cmsg->cmsg_len = CMSG_LEN(sizeof(int));
 	cmsg->cmsg_level = SOL_SOCKET;
 	cmsg->cmsg_type = SCM_RIGHTS;
 	*(int *)CMSG_DATA(cmsg) = fd;
@@ -75,7 +75,7 @@ static ssize_t sendFd(int sock, int fd) {
 }
 
 static int recvFd(int sock) {
-	size_t size = CMSG_LEN(sizeof(int));
+	size_t size = CMSG_SPACE(sizeof(int));
 	char buf[size];
 	struct msghdr msg = {
 		.msg_iov = &iov,
esse 2019-06-05global: make 'char *path' const where possibleChristian Hesse 2019-05-20ui-shared: restrict to 15 levelsJason A. Donenfeld 2019-02-23ui-diff,ui-tag: don't use htmlf with non-formatted stringsChris Mayo 2019-02-23ui-ssdiff: resolve HTML5 validation errorsChris Mayo 2019-01-03filters: migrate from luacrypto to luaosslJason A. Donenfeld 2019-01-02ui-shared: fix broken sizeof in title setting and rewriteJason A. Donenfeld 2018-12-09git: update to v2.20.0Christian Hesse 2018-11-25ui-blame: set repo for sbJason A. Donenfeld 2018-11-25auth-filter: pass url with query string attachedJason A. Donenfeld 2018-11-21git: use xz compressed archive for downloadChristian Hesse 2018-10-12git: update to v2.19.1Christian Hesse 2018-09-11ui-ssdiff: ban strcat()Christian Hesse 2018-09-11ui-ssdiff: ban strncpy()Christian Hesse 2018-09-11ui-shared: ban strcat()Christian Hesse 2018-09-11ui-patch: ban sprintf()Christian Hesse 2018-09-11ui-log: ban strncpy()Christian Hesse 2018-09-11ui-log: ban strcpy()Christian Hesse 2018-09-11parsing: ban sprintf()Christian Hesse 2018-09-11parsing: ban strncpy()Christian Hesse 2018-08-28filters: generate anchor links from markdownChristian Hesse 2018-08-03Bump version.Jason A. Donenfeld 2018-08-03clone: fix directory traversalJason A. Donenfeld 2018-08-03config: record repo.snapshot-prefix in the per-repo configKonstantin Ryabitsev