diff options
author | Mathias Krause <minipli@googlemail.com> | 2017-08-26 11:08:58 -0400 |
---|---|---|
committer | Steffen Klassert <steffen.klassert@secunet.com> | 2017-08-28 04:58:02 -0400 |
commit | 50329c8a340c9dea60d837645fcf13fc36bfb84d (patch) | |
tree | c54e85cb149711b653ef3953d6dbe18e4d444615 | |
parent | 5fe0d4bd8f86d19f7f24c1ae5a9b6e6a5a52e51a (diff) |
xfrm_user: fix info leak in xfrm_notify_sa()
The memory reserved to dump the ID of the xfrm state includes a padding
byte in struct xfrm_usersa_id added by the compiler for alignment. To
prevent the heap info leak, memset(0) the whole struct before filling
it.
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Fixes: 0603eac0d6b7 ("[IPSEC]: Add XFRMA_SA/XFRMA_POLICY for delete notification")
Signed-off-by: Mathias Krause <minipli@googlemail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
-rw-r--r-- | net/xfrm/xfrm_user.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 3259555ae7d7..c33516ef52f2 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -2715,6 +2715,7 @@ static int xfrm_notify_sa(struct xfrm_state *x, const struct km_event *c) | |||
2715 | struct nlattr *attr; | 2715 | struct nlattr *attr; |
2716 | 2716 | ||
2717 | id = nlmsg_data(nlh); | 2717 | id = nlmsg_data(nlh); |
2718 | memset(id, 0, sizeof(*id)); | ||
2718 | memcpy(&id->daddr, &x->id.daddr, sizeof(id->daddr)); | 2719 | memcpy(&id->daddr, &x->id.daddr, sizeof(id->daddr)); |
2719 | id->spi = x->id.spi; | 2720 | id->spi = x->id.spi; |
2720 | id->family = x->props.family; | 2721 | id->family = x->props.family; |