]> git.proxmox.com Git - mirror_lxc.git/commit - src/lxc/network.c
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 16:49:57 +0000 (11:49 -0500)
commit06f976cad74d027c8080b594eefb391298b4c341
treec801a235afb6ad0e745c8e8f8d0555c913ec56fc
parent21e624d9cf79d05179030f1534552048e0c506f5
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