]> git.ipfire.org Git - thirdparty/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>
Thu, 4 Dec 2014 20:29:58 +0000 (15:29 -0500)
commitdc990b1d9f26cd860ee9cf49034e36fe63ba76b2
treea8bcd8e710d4d1ffabf2178432bb68f366d33b52
parente5e0bc557a2aabb8b1173144ba602b7b874dc9ab
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