diff options
author | Luiz Augusto von Dentz | 2024-02-28 12:11:08 -0500 |
---|---|---|
committer | Luiz Augusto von Dentz | 2024-03-06 17:26:24 -0500 |
commit | 0f0639b4d6f649338ce29c62da3ec0787fa08cd1 (patch) | |
tree | 7112c3c4b2bb86ff81b62394414884a5adb84f96 | |
parent | 79f4127a502c5905f04da1f20a7bbe07103fb77c (diff) |
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 <luiz.von.dentz@intel.com>
-rw-r--r-- | net/bluetooth/bnep/core.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/net/bluetooth/bnep/core.c b/net/bluetooth/bnep/core.c index 8c3f8d0c0358..ec45f77fce21 100644 --- a/net/bluetooth/bnep/core.c +++ b/net/bluetooth/bnep/core.c @@ -385,7 +385,8 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb) case BNEP_COMPRESSED_DST_ONLY: __skb_put_data(nskb, skb_mac_header(skb), ETH_ALEN); - __skb_put_data(nskb, s->eh.h_source, ETH_ALEN + 2); + __skb_put_data(nskb, s->eh.h_source, ETH_ALEN); + put_unaligned(s->eh.h_proto, (__be16 *)__skb_put(nskb, 2)); break; case BNEP_GENERAL: |