wlantest: Handle missing fields in TDLS Setup Response error case

This commit is contained in:
Jouni Malinen 2011-01-24 18:16:26 +02:00 committed by Jouni Malinen
parent 5acf56f6a2
commit 2878cae7a7

View file

@ -284,13 +284,14 @@ static void rx_data_tdls_setup_response(struct wlantest *wt, const u8 *bssid,
wpa_printf(MSG_DEBUG, "TDLS Setup Response " MACSTR " -> " wpa_printf(MSG_DEBUG, "TDLS Setup Response " MACSTR " -> "
MACSTR " (status %d)", MACSTR " (status %d)",
MAC2STR(src), MAC2STR(dst), status); MAC2STR(src), MAC2STR(dst), status);
if (len < 5) { if (len < 5 && status == 0) {
wpa_printf(MSG_INFO, "Too short TDLS Setup Response " MACSTR wpa_printf(MSG_INFO, "Too short TDLS Setup Response " MACSTR
" -> " MACSTR, MAC2STR(src), MAC2STR(dst)); " -> " MACSTR, MAC2STR(src), MAC2STR(dst));
return; return;
} }
if (ieee802_11_parse_elems(data + 5, len - 5, &elems, 1) == if (len < 5 ||
ieee802_11_parse_elems(data + 5, len - 5, &elems, 1) ==
ParseFailed || elems.link_id == NULL) { ParseFailed || elems.link_id == NULL) {
/* Need to match TDLS link based on Dialog Token */ /* Need to match TDLS link based on Dialog Token */
rx_data_tdls_setup_response_failure(wt, bssid, sta_addr, rx_data_tdls_setup_response_failure(wt, bssid, sta_addr,