Commit b3563c4f authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETLINK]: Clear padding in netlink messages

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4095ebf1
...@@ -168,6 +168,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags) ...@@ -168,6 +168,7 @@ __nlmsg_put(struct sk_buff *skb, u32 pid, u32 seq, int type, int len, int flags)
nlh->nlmsg_flags = flags; nlh->nlmsg_flags = flags;
nlh->nlmsg_pid = pid; nlh->nlmsg_pid = pid;
nlh->nlmsg_seq = seq; nlh->nlmsg_seq = seq;
memset(NLMSG_DATA(nlh) + len, 0, NLMSG_ALIGN(size) - size);
return nlh; return nlh;
} }
......
...@@ -898,7 +898,9 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi ...@@ -898,7 +898,9 @@ extern void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const voi
memcpy(skb_put(skb, attrlen), data, attrlen); }) memcpy(skb_put(skb, attrlen), data, attrlen); })
#define RTA_PUT_NOHDR(skb, attrlen, data) \ #define RTA_PUT_NOHDR(skb, attrlen, data) \
RTA_APPEND(skb, RTA_ALIGN(attrlen), data) ({ RTA_APPEND(skb, RTA_ALIGN(attrlen), data); \
memset(skb->tail - (RTA_ALIGN(attrlen) - attrlen), 0, \
RTA_ALIGN(attrlen) - attrlen); })
#define RTA_PUT_U8(skb, attrtype, value) \ #define RTA_PUT_U8(skb, attrtype, value) \
({ u8 _tmp = (value); \ ({ u8 _tmp = (value); \
...@@ -978,6 +980,7 @@ __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen) ...@@ -978,6 +980,7 @@ __rta_reserve(struct sk_buff *skb, int attrtype, int attrlen)
rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size)); rta = (struct rtattr*)skb_put(skb, RTA_ALIGN(size));
rta->rta_type = attrtype; rta->rta_type = attrtype;
rta->rta_len = size; rta->rta_len = size;
memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
return rta; return rta;
} }
......
...@@ -126,6 +126,7 @@ void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data ...@@ -126,6 +126,7 @@ void __rta_fill(struct sk_buff *skb, int attrtype, int attrlen, const void *data
rta->rta_type = attrtype; rta->rta_type = attrtype;
rta->rta_len = size; rta->rta_len = size;
memcpy(RTA_DATA(rta), data, attrlen); memcpy(RTA_DATA(rta), data, attrlen);
memset(RTA_DATA(rta) + attrlen, 0, RTA_ALIGN(size) - size);
} }
size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size) size_t rtattr_strlcpy(char *dest, const struct rtattr *rta, size_t size)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment