mirror of
https://github.com/opnsense/src.git
synced 2026-02-11 14:55:36 -05:00
linux(4): Fix control message size calculation
To determine the size in bytes needed to hold a control message and its contents of length len, CMSG_SPACE should be used. Reviewed by: Differential Revision: https://reviews.freebsd.org/D41224 MFC after: 1 week
This commit is contained in:
parent
38588749af
commit
67116c6905
1 changed files with 2 additions and 2 deletions
|
|
@ -1852,7 +1852,7 @@ cont:
|
|||
if (error != 0)
|
||||
goto bad;
|
||||
|
||||
if (outlen + LINUX_CMSG_LEN(datalen) > maxlen) {
|
||||
if (outlen + LINUX_CMSG_SPACE(datalen) > maxlen) {
|
||||
if (outlen == 0) {
|
||||
error = EMSGSIZE;
|
||||
goto err;
|
||||
|
|
@ -1871,7 +1871,7 @@ cont:
|
|||
error = copyout(data, outbuf, datalen);
|
||||
if (error == 0) {
|
||||
outbuf += LINUX_CMSG_ALIGN(datalen);
|
||||
outlen += LINUX_CMSG_LEN(datalen);
|
||||
outlen += LINUX_CMSG_SPACE(datalen);
|
||||
}
|
||||
}
|
||||
err:
|
||||
|
|
|
|||
Loading…
Reference in a new issue