Skip to content

Commit 0f0639b

Browse files
committed
Bluetooth: bnep: Fix out-of-bound access
This fixes attempting to access past ethhdr.h_source, although it seems intentional to copy also the contents of h_proto this triggers out-of-bound access problems with the likes of static analyzer, so this instead just copy ETH_ALEN and then proceed to use put_unaligned to copy h_proto separetely. Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 79f4127 commit 0f0639b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/bluetooth/bnep/core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,8 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)
385385

386386
case BNEP_COMPRESSED_DST_ONLY:
387387
__skb_put_data(nskb, skb_mac_header(skb), ETH_ALEN);
388-
__skb_put_data(nskb, s->eh.h_source, ETH_ALEN + 2);
388+
__skb_put_data(nskb, s->eh.h_source, ETH_ALEN);
389+
put_unaligned(s->eh.h_proto, (__be16 *)__skb_put(nskb, 2));
389390
break;
390391

391392
case BNEP_GENERAL:

0 commit comments

Comments
 (0)