diff options
author | Masashi Honma <masashi.honma@gmail.com> | 2012-07-02 20:53:46 +0300 |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2012-07-02 20:53:46 +0300 |
commit | 8f4636e41c621b1a930b43614eda7825a3f20c2f (patch) | |
tree | 18b333192414d3a6760c2b10df6796478ea4ec91 /src/p2p | |
parent | 0cb87fdeb58b3de54a325179f07fba3dfe71d0ef (diff) | |
download | external_wpa_supplicant_8_ti-8f4636e41c621b1a930b43614eda7825a3f20c2f.zip external_wpa_supplicant_8_ti-8f4636e41c621b1a930b43614eda7825a3f20c2f.tar.gz external_wpa_supplicant_8_ti-8f4636e41c621b1a930b43614eda7825a3f20c2f.tar.bz2 |
P2P: Check memory allocation result in a Service Discovery Response
This patch adds a check of the return value of wpabuf_dup() in a large
Service Discovery Response.
Signed-hostap: Masashi Honma <masashi.honma@gmail.com>
Diffstat (limited to 'src/p2p')
-rw-r--r-- | src/p2p/p2p_sd.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/p2p/p2p_sd.c b/src/p2p/p2p_sd.c index 1a57210..5cf1cfe 100644 --- a/src/p2p/p2p_sd.c +++ b/src/p2p/p2p_sd.c @@ -364,9 +364,14 @@ void p2p_sd_response(struct p2p_data *p2p, int freq, const u8 *dst, "previous SD response"); wpabuf_free(p2p->sd_resp); } + p2p->sd_resp = wpabuf_dup(resp_tlvs); + if (p2p->sd_resp == NULL) { + wpa_msg(p2p->cfg->msg_ctx, MSG_ERROR, "P2P: Failed to " + "allocate SD response fragmentation area"); + return; + } os_memcpy(p2p->sd_resp_addr, dst, ETH_ALEN); p2p->sd_resp_dialog_token = dialog_token; - p2p->sd_resp = wpabuf_dup(resp_tlvs); p2p->sd_resp_pos = 0; p2p->sd_frag_id = 0; resp = p2p_build_sd_response(dialog_token, WLAN_STATUS_SUCCESS, |