summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2012-10-07 12:05:26 -0700
committerKeith Packard <keithp@keithp.com>2012-10-07 12:06:00 -0700
commitd4d31cd5f12b352fde11f323f898dd524b878c74 (patch)
treec54858559ecc564b9f7f9cb3fab7af8a30e63203
parentfb29490270f30c372d677613d94351006994dee3 (diff)
Add check for truncated control messageHEADmaster
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--fdpass.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fdpass.c b/fdpass.c
index 7ae33d7..6e2e0c7 100644
--- a/fdpass.c
+++ b/fdpass.c
@@ -45,6 +45,11 @@ sock_fd_read(int sock, void *buf, ssize_t bufsize, int *fd)
perror ("recvmsg");
exit(1);
}
+ if ((msg.msg_flags & MSG_TRUNC) ||
+ (msg.msg_flags & MSG_CTRUNC)) {
+ fprintf (stderr, "control message truncated");
+ exit(1);
+ }
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg && cmsg->cmsg_len == CMSG_LEN(sizeof(int))) {
if (cmsg->cmsg_level != SOL_SOCKET) {