embeddable-wg-library: zero attribute padding
See: http://git.netfilter.org/libmnl/commit/?id=37c876b55a2c00424ccda5a300ab5fdec1d88b22 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
f36209f588
commit
f8a990763a
|
@ -358,11 +358,15 @@ static void mnl_attr_put(struct nlmsghdr *nlh, uint16_t type, size_t len,
|
||||||
{
|
{
|
||||||
struct nlattr *attr = mnl_nlmsg_get_payload_tail(nlh);
|
struct nlattr *attr = mnl_nlmsg_get_payload_tail(nlh);
|
||||||
uint16_t payload_len = MNL_ALIGN(sizeof(struct nlattr)) + len;
|
uint16_t payload_len = MNL_ALIGN(sizeof(struct nlattr)) + len;
|
||||||
|
int pad;
|
||||||
|
|
||||||
attr->nla_type = type;
|
attr->nla_type = type;
|
||||||
attr->nla_len = payload_len;
|
attr->nla_len = payload_len;
|
||||||
memcpy(mnl_attr_get_payload(attr), data, len);
|
memcpy(mnl_attr_get_payload(attr), data, len);
|
||||||
nlh->nlmsg_len += MNL_ALIGN(payload_len);
|
nlh->nlmsg_len += MNL_ALIGN(payload_len);
|
||||||
|
pad = MNL_ALIGN(len) - len;
|
||||||
|
if (pad > 0)
|
||||||
|
memset(mnl_attr_get_payload(attr) + len, 0, pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mnl_attr_put_u16(struct nlmsghdr *nlh, uint16_t type, uint16_t data)
|
static void mnl_attr_put_u16(struct nlmsghdr *nlh, uint16_t type, uint16_t data)
|
||||||
|
|
Loading…
Reference in New Issue