GAS server: Fix request frame length validation (CID 68098)
authorJouni Malinen <j@w1.fi>
Thu, 12 Jun 2014 19:10:43 +0000 (22:10 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 12 Jun 2014 21:27:15 +0000 (00:27 +0300)
commit062833c67cbf324ecc7724cd0290a7eb093ffd7a
treeaa36022810a5f65d343476985021aef50672d06b
parent6ec64f3ec871d38138ffcec4f1ca33af96ae1505
GAS server: Fix request frame length validation (CID 68098)

There seemed to be an off-by-one error in the validation of GAS request
frames. If a Public Action frame without the Action code field would
have reached this function, the length could have been passed as
(size_t) -1 which would likely have resulted in a crash due to reading
beyond the buffer. However, it looks like such frame would not be
delivered to hostapd at least with mac80211-based drivers. Anyway, this
function better be more careful with length validation should some other
driver end up reporting invalid Action frames.

In addition, the Action code field is in a fixed location, so the
IEEE80211_HDRLEN can be used here to clean up bounds checking to avoid
false reports from static analyzer.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/gas_serv.c