Patch for unexpectedly aligned messages

Thomas Graf tgraf at infradead.org
Wed Sep 2 12:43:32 EDT 2009


On Wed, Aug 26, 2009 at 04:28:01PM -0500, Marc de Kruijf wrote:
> I have been using the libnl's generic netlink support for my user
> application.  I found the following bug, where nlmsg_ok() in lib/msg.c would
> incorrectly return 'true' when the input argument 'remaining' was a negative
> number.  This happens when the message is not aligned the way that libnl
> expects (although it is still legal).
> 
> In the comparison of the signed and unsigned numbers on line 284, the signed
> number gets converted to an unsigned number, which is unexpected and
> naturally produces a bug.  My patch is below.  The cast is ugly, but it
> fixes the problem.

Applied, thanks a lot Marc.



More information about the libnl mailing list