aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap
diff options
context:
space:
mode:
authorJouni Malinen <jouni.malinen@atheros.com>2009-12-28 10:58:27 (GMT)
committerJouni Malinen <j@w1.fi>2009-12-28 10:58:27 (GMT)
commit1c08f8c0f090257c607e7b89f754b4f9a57c9f55 (patch)
tree626203b63a672221a0c2a880113fe4a6ce5bfe10 /src/ap
parentd566f4152fb45b63097a6b9cd452ca8ad8ad43ac (diff)
downloadhostap-1c08f8c0f090257c607e7b89f754b4f9a57c9f55.zip
hostap-1c08f8c0f090257c607e7b89f754b4f9a57c9f55.tar.gz
hostap-1c08f8c0f090257c607e7b89f754b4f9a57c9f55.tar.bz2
Allocate Probe Response and Beacon buffers based on WPS IE length
This IE is of variable length and it is better to allocate the frame buffer taking this length into account to prepare for future additions.
Diffstat (limited to 'src/ap')
-rw-r--r--src/ap/beacon.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index b01a378..9c65760 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -202,6 +202,7 @@ void handle_probe_req(struct hostapd_data *hapd,
const u8 *ie;
size_t ssid_len, ie_len;
struct sta_info *sta = NULL;
+ size_t buflen;
size_t i;
ie = mgmt->u.probe_req.variable;
@@ -263,7 +264,12 @@ void handle_probe_req(struct hostapd_data *hapd,
/* TODO: verify that supp_rates contains at least one matching rate
* with AP configuration */
#define MAX_PROBERESP_LEN 768
- resp = os_zalloc(MAX_PROBERESP_LEN);
+ buflen = MAX_PROBERESP_LEN;
+#ifdef CONFIG_WPS
+ if (hapd->wps_probe_resp_ie)
+ buflen += wpabuf_len(hapd->wps_probe_resp_ie);
+#endif /* CONFIG_WPS */
+ resp = os_zalloc(buflen);
if (resp == NULL)
return;
epos = ((u8 *) resp) + MAX_PROBERESP_LEN;
@@ -340,7 +346,12 @@ void ieee802_11_set_beacon(struct hostapd_data *hapd)
#define BEACON_HEAD_BUF_SIZE 256
#define BEACON_TAIL_BUF_SIZE 512
head = os_zalloc(BEACON_HEAD_BUF_SIZE);
- tailpos = tail = os_malloc(BEACON_TAIL_BUF_SIZE);
+ tail_len = BEACON_TAIL_BUF_SIZE;
+#ifdef CONFIG_WPS
+ if (hapd->conf->wps_state && hapd->wps_beacon_ie)
+ tail_len += wpabuf_len(hapd->wps_beacon_ie);
+#endif /* CONFIG_WPS */
+ tailpos = tail = os_malloc(tail_len);
if (head == NULL || tail == NULL) {
wpa_printf(MSG_ERROR, "Failed to set beacon data");
os_free(head);