Skip to content

Commit a5cc68f

Browse files
miniplidavem330
authored andcommitted
af_key: fix info leaks in notify messages
key_notify_sa_flush() and key_notify_policy_flush() miss to initialize the sadb_msg_reserved member of the broadcasted message and thereby leak 2 bytes of heap memory to listeners. Fix that. Signed-off-by: Mathias Krause <minipli@googlemail.com> Cc: Steffen Klassert <steffen.klassert@secunet.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent a963a37 commit a5cc68f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/key/af_key.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,6 +1710,7 @@ static int key_notify_sa_flush(const struct km_event *c)
17101710
hdr->sadb_msg_version = PF_KEY_V2;
17111711
hdr->sadb_msg_errno = (uint8_t) 0;
17121712
hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t));
1713+
hdr->sadb_msg_reserved = 0;
17131714

17141715
pfkey_broadcast(skb, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net);
17151716

@@ -2699,6 +2700,7 @@ static int key_notify_policy_flush(const struct km_event *c)
26992700
hdr->sadb_msg_errno = (uint8_t) 0;
27002701
hdr->sadb_msg_satype = SADB_SATYPE_UNSPEC;
27012702
hdr->sadb_msg_len = (sizeof(struct sadb_msg) / sizeof(uint64_t));
2703+
hdr->sadb_msg_reserved = 0;
27022704
pfkey_broadcast(skb_out, GFP_ATOMIC, BROADCAST_ALL, NULL, c->net);
27032705
return 0;
27042706

0 commit comments

Comments
 (0)