mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-14 16:46:21 +00:00
fix wrong nlmsg_len
nlmsg_len is the length of message including header. Signed-off-by: Shuai Zhang <zs.broccoli@gmail.com> Acked-by: Stéphane Graber <stgraber@ubuntu.com>
This commit is contained in:
parent
a6ee12772a
commit
b588716468
@ -107,14 +107,14 @@ void nla_end_nested(struct nlmsg *nlmsg, struct rtattr *attr)
|
||||
extern struct nlmsg *nlmsg_alloc(size_t size)
|
||||
{
|
||||
struct nlmsg *nlmsg;
|
||||
size_t len = NLMSG_ALIGN(size) + NLMSG_ALIGN(sizeof(struct nlmsghdr *));
|
||||
size_t len = NLMSG_HDRLEN + NLMSG_ALIGN(size);
|
||||
|
||||
nlmsg = (struct nlmsg *)malloc(len);
|
||||
if (!nlmsg)
|
||||
return NULL;
|
||||
|
||||
memset(nlmsg, 0, len);
|
||||
nlmsg->nlmsghdr.nlmsg_len = NLMSG_ALIGN(size);
|
||||
nlmsg->nlmsghdr.nlmsg_len = NLMSG_HDRLEN;
|
||||
|
||||
return nlmsg;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user