mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 08:48:31 -05:00
EAP-pwd server: Fix reassembly buffer handling
data->inbuf allocation might fail and if that were to happen, the next fragment in the exchange could have resulted in NULL pointer dereference. Unexpected fragment with more bit might also be able to trigger this. Fix that by explicitly checking for data->inbuf to be available before using it. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
a9d224f560
commit
fe76f487e2
@ -912,6 +912,12 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
|
|||||||
* the first and all intermediate fragments have the M bit set
|
* the first and all intermediate fragments have the M bit set
|
||||||
*/
|
*/
|
||||||
if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
|
if (EAP_PWD_GET_MORE_BIT(lm_exch) || data->in_frag_pos) {
|
||||||
|
if (!data->inbuf) {
|
||||||
|
wpa_printf(MSG_DEBUG,
|
||||||
|
"EAP-pwd: No buffer for reassembly");
|
||||||
|
eap_pwd_state(data, FAILURE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
|
if ((data->in_frag_pos + len) > wpabuf_size(data->inbuf)) {
|
||||||
wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
|
wpa_printf(MSG_DEBUG, "EAP-pwd: Buffer overflow "
|
||||||
"attack detected! (%d+%d > %d)",
|
"attack detected! (%d+%d > %d)",
|
||||||
@ -932,7 +938,7 @@ static void eap_pwd_process(struct eap_sm *sm, void *priv,
|
|||||||
* last fragment won't have the M bit set (but we're obviously
|
* last fragment won't have the M bit set (but we're obviously
|
||||||
* buffering fragments so that's how we know it's the last)
|
* buffering fragments so that's how we know it's the last)
|
||||||
*/
|
*/
|
||||||
if (data->in_frag_pos) {
|
if (data->in_frag_pos && data->inbuf) {
|
||||||
pos = wpabuf_head_u8(data->inbuf);
|
pos = wpabuf_head_u8(data->inbuf);
|
||||||
len = data->in_frag_pos;
|
len = data->in_frag_pos;
|
||||||
wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
|
wpa_printf(MSG_DEBUG, "EAP-pwd: Last fragment, %d bytes",
|
||||||
|
Loading…
Reference in New Issue
Block a user