Skip to content

Commit

Permalink
net: ieee802154_mgmt: Fix memcpy to uninitialized pointer location
Browse files Browse the repository at this point in the history
As since commit bff6a5c, params.dst.ext_addr is no longer assigned with
the ctx->coord_ext_addr pointer, but a endianness swap is included, it
should be assigned with a proper buffer before the memcpy.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
  • Loading branch information
rlubos authored and nashif committed Jun 7, 2023
1 parent f9a818c commit 233524f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions subsys/net/l2/ieee802154/ieee802154_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ static int ieee802154_disassociate(uint32_t mgmt_request, struct net_if *iface,
void *data, size_t len)
{
struct ieee802154_context *ctx = net_if_l2_data(iface);
uint8_t ext_addr[IEEE802154_MAX_ADDR_LENGTH];
struct ieee802154_frame_params params;
struct ieee802154_command *cmd;
struct net_pkt *pkt;
Expand All @@ -477,6 +478,7 @@ static int ieee802154_disassociate(uint32_t mgmt_request, struct net_if *iface,
params.dst.short_addr = ctx->coord_short_addr;
} else {
params.dst.len = IEEE802154_EXT_ADDR_LENGTH;
params.dst.ext_addr = ext_addr;
sys_memcpy_swap(params.dst.ext_addr, ctx->coord_ext_addr,
IEEE802154_EXT_ADDR_LENGTH);
}
Expand Down

0 comments on commit 233524f

Please sign in to comment.