net: ieee802154: Fix possible null pointer de-reference

ieee802154_scan() checks if ctx->scan_ctx (scan) is NULL what implies
that this can be true, but de-reference this variable before this
check what may cause a problem.

Fixes #23299 [3]

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2020-03-16 15:15:56 -07:00 committed by Maureen Helm
commit 6fec8ea84e

View file

@ -97,6 +97,10 @@ static int ieee802154_scan(u32_t mgmt_request, struct net_if *iface,
return -EALREADY;
}
if (scan == NULL) {
return -EINVAL;
}
if (mgmt_request == NET_REQUEST_IEEE802154_ACTIVE_SCAN) {
struct ieee802154_frame_params params;