• Mathias Krause's avatar
    audit: use nlmsg_len() to get message payload length · 4d8fe737
    Mathias Krause authored
    Using the nlmsg_len member of the netlink header to test if the message
    is valid is wrong as it includes the size of the netlink header itself.
    Thereby allowing to send short netlink messages that pass those checks.
    
    Use nlmsg_len() instead to test for the right message length. The result
    of nlmsg_len() is guaranteed to be non-negative as the netlink message
    already passed the checks of nlmsg_ok().
    
    Also switch to min_t() to please checkpatch.pl.
    
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Cc: Eric Paris <eparis@redhat.com>
    Cc: stable@vger.kernel.org  # v2.6.6+ for the 1st hunk, v2.6.23+ for the 2nd
    Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
    Signed-off-by: default avatarRichard Guy Briggs <rgb@redhat.com>
    Signed-off-by: default avatarEric Paris <eparis@redhat.com>
    4d8fe737
audit.c 47.2 KB