From: Shuai Zhang Date: Thu, 27 Nov 2014 12:38:01 +0000 (+0800) Subject: fix wrong nlmsg_len X-Git-Tag: lxc-1.1.0.alpha3~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b588716468c4171d60cbdb4afd2e747a6fa394b1;p=thirdparty%2Flxc.git fix wrong nlmsg_len nlmsg_len is the length of message including header. Signed-off-by: Shuai Zhang Acked-by: Stéphane Graber --- diff --git a/src/lxc/nl.c b/src/lxc/nl.c index 7c0f1e53b..132a907f7 100644 --- a/src/lxc/nl.c +++ b/src/lxc/nl.c @@ -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; }