[PATCH] lib: Return error if an incomplete message was read
Thomas Haller
thaller at redhat.com
Thu Jun 4 23:43:25 PDT 2015
On Do, 2015-06-04 at 14:43 +0200, Thomas Egerer wrote:
> If recvmsg indicates that the message read was truncated libnl
> retries
> to read the complete message after increasing the message buffer.
> This
> only works if the message flags MSG_PEEK | MSG_TRUNC are set. If
> NL_MSG_PEEK is not enabled on the nl_sock structure, flags are left
> empty and the rest of the truncated message is discarded, hence a
> subsequent recvmsg returns the next message (in case of a multipart
> message, the NLMSG_DONE) is read and returned.
> This patch aborts message processing if the message was truncated and
> teh NL_MSG_PEEK flags was not activated for the nl_sock structure.
>
> Signed-off-by: Thomas Egerer <hakke_007 at gmx.de>
> ---
Hi Thomas,
this fix looks right to me and its a pretty bad bug.
Applied as
https://github.com/thom311/libnl/commit/bbdcaea9a779885fedc04817dcc119
53a377bfd5
I added NL_CAPABILITY_NL_RECV_FAIL_TRUNK_NO_PEEK to your patch.
Thank you.
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/libnl/attachments/20150605/e567c882/attachment.sig>
More information about the libnl
mailing list