RecvMsg.cmsg() should check MSG_CTRUNC
agrover opened this issue · comments
Andy Grover commented
If the cmsg buffer is too small, MSG_CTRUNC will be set in the header flags. This should be checked before returning CmsgIterator
, or else the iterator might return invalid data.
SteveLauC commented
Hi, that indeed should be checked, do you have a good interface for this change in mind?
Andy Grover commented
Hi, that indeed should be checked, do you have a good interface for this change in mind?
I think the simplest thing, although an API change, would be to change RecvMsg::cmsgs()
to return a Result<CmsgIterator>
instead of a CmsgIterator
, and return an error if MSG_CTRUNC
was set.