aboutsummaryrefslogtreecommitdiffstats
path: root/src/wps
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2015-09-07 19:52:45 (GMT)
committerJouni Malinen <j@w1.fi>2015-09-07 19:52:45 (GMT)
commitb664ef1c0d97dbf8b127408b4b63eb35e36aa5bb (patch)
tree97d0139e78a44b24d9f81d5746e6b61b73cf0fa9 /src/wps
parent53bd8653c2c6b4c34c6419f0cdb37c302961f8f0 (diff)
downloadhostap-b664ef1c0d97dbf8b127408b4b63eb35e36aa5bb.zip
hostap-b664ef1c0d97dbf8b127408b4b63eb35e36aa5bb.tar.gz
hostap-b664ef1c0d97dbf8b127408b4b63eb35e36aa5bb.tar.bz2
WPS: Reduce wps_ap_priority_compar() stack use
There is no need to maintain two concurrent instances of struct wps_parse_attr in this function. Share a single structure for parsing both IEs. Signed-off-by: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/wps')
-rw-r--r--src/wps/wps.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/wps/wps.c b/src/wps/wps.c
index 498f11f..fbaf85a 100644
--- a/src/wps/wps.c
+++ b/src/wps/wps.c
@@ -355,16 +355,16 @@ int wps_is_addr_authorized(const struct wpabuf *msg, const u8 *addr,
int wps_ap_priority_compar(const struct wpabuf *wps_a,
const struct wpabuf *wps_b)
{
- struct wps_parse_attr attr_a, attr_b;
+ struct wps_parse_attr attr;
int sel_a, sel_b;
- if (wps_a == NULL || wps_parse_msg(wps_a, &attr_a) < 0)
+ if (wps_a == NULL || wps_parse_msg(wps_a, &attr) < 0)
return 1;
- if (wps_b == NULL || wps_parse_msg(wps_b, &attr_b) < 0)
- return -1;
+ sel_a = attr.selected_registrar && *attr.selected_registrar != 0;
- sel_a = attr_a.selected_registrar && *attr_a.selected_registrar != 0;
- sel_b = attr_b.selected_registrar && *attr_b.selected_registrar != 0;
+ if (wps_b == NULL || wps_parse_msg(wps_b, &attr) < 0)
+ return -1;
+ sel_b = attr.selected_registrar && *attr.selected_registrar != 0;
if (sel_a && !sel_b)
return -1;