hostapd/src/p2p
Jouni Malinen 8460e32309 P2P: Fix a corner case in peer addition based on PD Request
p2p_add_device() may remove the oldest entry if there is no room in the
peer table for a new peer. This would result in any pointer to that
removed entry becoming stale. A corner case with an invalid PD Request
frame could result in such a case ending up using (read+write) freed
memory. This could only by triggered when the peer table has reached its
maximum size and the PD Request frame is received from the P2P Device
Address of the oldest remaining entry and the frame has incorrect P2P
Device Address in the payload.

Fix this by fetching the dev pointer again after having called
p2p_add_device() so that the stale pointer cannot be used.

Fixes: 17bef1e97a ("P2P: Add peer entry based on Provision Discovery Request")
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
2021-02-25 20:09:46 +02:00
..
Makefile build: Make more library things common 2020-10-12 20:20:35 +03:00
p2p.c P2P: Add a maximum length limit for peer vendor IEs 2021-02-05 01:39:29 +02:00
p2p.h P2P: Delay P2P scan when an external scan is in progress 2020-12-21 23:22:51 +02:00
p2p_build.c WPS: Add multi_ap_subelem to wps_build_wfa_ext() 2019-02-18 20:30:26 +02:00
p2p_dev_disc.c P2PS: Refactor p2p_data::query_hash and p2p_data::query_count use 2015-06-15 17:30:01 +03:00
p2p_go_neg.c P2P: Add support for EDMG channels 2019-12-20 00:13:08 +02:00
p2p_group.c P2P: Stop listen state if Action frame TX is needed on another channel 2019-02-17 16:53:03 +02:00
p2p_i.h P2P: Send Action frame regardless if p2p_scan in progress 2019-05-31 16:52:15 +03:00
p2p_invitation.c P2P: Allow the avoid channels for P2P discovery/negotiation 2019-01-30 12:15:19 +02:00
p2p_parse.c P2P: Filter control chars in group client device name similarly to peer 2015-10-26 23:43:45 +02:00
p2p_pd.c P2P: Fix a corner case in peer addition based on PD Request 2021-02-25 20:09:46 +02:00
p2p_sd.c P2P: Do not use wait_time for SD Response TX for last fragmentation 2017-04-01 14:25:26 +03:00
p2p_utils.c P2P: Allow the avoid channels for P2P discovery/negotiation 2019-01-30 12:15:19 +02:00