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 1, 2014
1 parent f38788b commit 55ae7ed
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 161 deletions.

0 comments on commit 55ae7ed

Please sign in to comment.