]> git.proxmox.com Git - mirror_lxc.git/commit
audit: added capacity and reserve() to nlmsg
authorShuai Zhang <zs.broccoli@gmail.com>
Sun, 30 Nov 2014 13:03:37 +0000 (21:03 +0800)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 1 Dec 2014 18:42:41 +0000 (13:42 -0500)
commit55ae7edb18c503a4b869dd0089f25f03a05a6563
treea122cdbcb9bc9379f58823f2998c365ab97257ae
parentf38788b405e6738bf3fbe6731e28c18967da71b2
audit: added capacity and reserve() to nlmsg

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>
src/lxc/network.c
src/lxc/nl.c
src/lxc/nl.h