From 42afc31cbe5e676b944dac5dbe04165790395a57 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Fri, 4 Jun 2021 03:50:44 +0200 Subject: [PATCH] p2p: Fix parsing of Association Req P2P IEs p2p_parse_association_req() already extracts the P2P IE payload from the IE sequence, there's no need to call ie_tlv_extract_p2p_payload before it. Pass the IE sequence directly to p2p_parse_association_req(). --- src/p2p.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/p2p.c b/src/p2p.c index 7e828412..bc2d154d 100644 --- a/src/p2p.c +++ b/src/p2p.c @@ -898,22 +898,11 @@ static void p2p_group_event(enum ap_event_type type, const void *event_data, case AP_EVENT_STATION_ADDED: { const struct ap_event_station_added_data *data = event_data; - L_AUTO_FREE_VAR(uint8_t *, p2p_data) = NULL; - ssize_t p2p_data_len; L_AUTO_FREE_VAR(uint8_t *, wfd_data) = NULL; ssize_t wfd_data_len; struct p2p_association_req req_info; int r; - p2p_data = ie_tlv_extract_p2p_payload(data->assoc_ies, - data->assoc_ies_len, - &p2p_data_len); - if (!p2p_data) { - l_error("Missing or invalid P2P IEs: %s (%i)", - strerror(-p2p_data_len), (int) -p2p_data_len); - goto invalid_ie; - } - /* * We don't need to validate most of the Association Request * P2P IE contents as we already have all the information there @@ -928,8 +917,8 @@ static void p2p_group_event(enum ap_event_type type, const void *event_data, * information shall be used by the P2P Group Owner for Group * Information Advertisement. */ - r = p2p_parse_association_req(p2p_data, p2p_data_len, - &req_info); + r = p2p_parse_association_req(data->assoc_ies, + data->assoc_ies_len, &req_info); if (r < 0) { l_error("Can't parse P2P Association Request: %s (%i)", strerror(-r), -r);