Skip to content

Commit f778a63

Browse files
miniplidavem330
authored andcommitted
xfrm_user: fix info leak in copy_to_user_state()
The memory reserved to dump the xfrm state includes the padding bytes of struct xfrm_usersa_info added by the compiler for alignment (7 for amd64, 3 for i386). Add an explicit memset(0) before filling the buffer to avoid the info leak. Signed-off-by: Mathias Krause <minipli@googlemail.com> Acked-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 4c87308 commit f778a63

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Diff for: net/xfrm/xfrm_user.c

+1
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,7 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh,
689689

690690
static void copy_to_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p)
691691
{
692+
memset(p, 0, sizeof(*p));
692693
memcpy(&p->id, &x->id, sizeof(p->id));
693694
memcpy(&p->sel, &x->sel, sizeof(p->sel));
694695
memcpy(&p->lft, &x->lft, sizeof(p->lft));

0 commit comments

Comments
 (0)