summaryrefslogtreecommitdiff
path: root/libexec/tftp-proxy/tftp-proxy.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2008-03-13 01:49:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2008-03-13 01:49:54 +0000
commitf806a02a48dffd4879055cd8cdc1895a0a6c926e (patch)
tree6c61227927ac37c4d373490dda12a0ed461491c8 /libexec/tftp-proxy/tftp-proxy.c
parent2d29c72143d0f8408606ffb11045f029da0762f6 (diff)
Correct CMSG_SPACE and CMSG_LEN usage everywhere in the tree. Due to
an extensive discussion with otto, kettenis, millert, and hshoexer
Diffstat (limited to 'libexec/tftp-proxy/tftp-proxy.c')
-rw-r--r--libexec/tftp-proxy/tftp-proxy.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/libexec/tftp-proxy/tftp-proxy.c b/libexec/tftp-proxy/tftp-proxy.c
index 18d3323e911..372731b1c3d 100644
--- a/libexec/tftp-proxy/tftp-proxy.c
+++ b/libexec/tftp-proxy/tftp-proxy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tftp-proxy.c,v 1.2 2006/12/20 03:33:38 joel Exp $
+/* $OpenBSD: tftp-proxy.c,v 1.3 2008/03/13 01:49:52 deraadt Exp $
*
* Copyright (c) 2005 DLS Internet Services
* Copyright (c) 2004, 2005 Camiel Dobbelaar, <cd@sentia.nl>
@@ -75,8 +75,10 @@ main(int argc, char *argv[])
char *p;
struct tftphdr *tp;
struct passwd *pw;
-
- char cbuf[CMSG_SPACE(sizeof(struct sockaddr_storage))];
+ union {
+ struct cmsghdr hdr;
+ char buf[CMSG_SPACE(sizeof(struct sockaddr_storage))];
+ } cmsgbuf;
char req[PKTSIZE];
struct cmsghdr *cmsg;
struct msghdr msg;
@@ -161,8 +163,8 @@ main(int argc, char *argv[])
msg.msg_namelen = sizeof(from);
msg.msg_iov = &iov;
msg.msg_iovlen = 1;
- msg.msg_control = cbuf;
- msg.msg_controllen = CMSG_LEN(sizeof(struct sockaddr_storage));
+ msg.msg_control = &cmsgbuf.buf;
+ msg.msg_controllen = sizeof(cmsgbuf.buf);
if (recvmsg(fd, &msg, 0) < 0) {
syslog(LOG_ERR, "recvmsg: %m");