Skip to content

Commit

Permalink
audit: added capacity and reserve() to nlmsg
Browse files Browse the repository at this point in the history
There are now two (permitted) ways to add data to netlink message:

 1. put_xxx()
 2. call nlmsg_reserve() to get a pointer to newly reserved room within the
    original netlink message, then write or memcpy data to that area.

Both of them guarantee adding requested length data do not overflow the
pre-allocated message buffer by checking against its cap field first.

And there may be no need to access nlmsg_len outside nl module, because both
put_xxx() and nlmsg_reserve() have alread did that for us.

Signed-off-by: Shuai Zhang <zs.broccoli@gmail.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
  • Loading branch information
Shuai Zhang authored and stgraber committed Dec 4, 2014
1 parent 21e624d commit 06f976c
Show file tree
Hide file tree
Showing 3 changed files with 231 additions and 181 deletions.

0 comments on commit 06f976c

Please sign in to comment.