mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
netdev: Allow NULL prefix in netdev_frame_watch_add
Make sure we don't pass NULLs to memcmp or l_memdup when the prefix buffer is NULL. There's no point having callers pass dummy buffers if they need to watch frames independent of the frame data.
This commit is contained in:
parent
8aa306fddc
commit
52b3268b78
@ -3676,7 +3676,8 @@ static bool netdev_frame_watch_match_prefix(const void *a, const void *b)
|
||||
|
||||
return fw->frame_type == info->frame_type &&
|
||||
fw->prefix_len <= info->body_len &&
|
||||
!memcmp(fw->prefix, info->body, fw->prefix_len);
|
||||
(fw->prefix_len == 0 ||
|
||||
!memcmp(fw->prefix, info->body, fw->prefix_len));
|
||||
}
|
||||
|
||||
static void netdev_mgmt_frame_event(struct l_genl_msg *msg,
|
||||
@ -4594,7 +4595,7 @@ uint32_t netdev_frame_watch_add(struct netdev *netdev, uint16_t frame_type,
|
||||
|
||||
fw = l_new(struct netdev_frame_watch, 1);
|
||||
fw->frame_type = frame_type;
|
||||
fw->prefix = l_memdup(prefix, prefix_len);
|
||||
fw->prefix = prefix_len ? l_memdup(prefix, prefix_len) : NULL;
|
||||
fw->prefix_len = prefix_len;
|
||||
id = watchlist_link(&netdev->frame_watches, &fw->super,
|
||||
handler, user_data, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user