When copying out multiple control messages, ensure that the next control

message is aligned.  From David Borman <dab@bsdi.com>.
This commit is contained in:
thorpej 1998-02-06 23:19:26 +00:00
parent 14580efdcf
commit 6b1ff3c892

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_syscalls.c,v 1.27 1998/01/07 23:47:10 thorpej Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.28 1998/02/06 23:19:26 thorpej Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@ -724,7 +724,7 @@ recvit(p, s, mp, namelenp, retsize)
struct mbuf *m = control;
caddr_t p = (caddr_t)mp->msg_control;
while (m) {
do {
i = m->m_len;
if (len < i) {
mp->msg_flags |= MSG_CTRUNC;
@ -732,12 +732,13 @@ recvit(p, s, mp, namelenp, retsize)
}
error = copyout(mtod(m, caddr_t), p,
(unsigned)i);
if (m->m_next)
i = ALIGN(i);
p += i;
len -= i;
if (error != 0 || len <= 0)
break;
m = m->m_next;
}
} while ((m = m->m_next) != NULL);
len = p - (caddr_t)mp->msg_control;
}
mp->msg_controllen = len;