TDLS: Use merge_byte_arrays() helper

This makes implementation simpler and easier for static analyzers to
understand.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-01-01 20:34:08 +02:00
parent 301ed630a8
commit de61795e7c

View file

@ -1309,21 +1309,10 @@ static int copy_supp_rates(const struct wpa_eapol_ie_parse *kde,
wpa_printf(MSG_DEBUG, "TDLS: No supported rates received"); wpa_printf(MSG_DEBUG, "TDLS: No supported rates received");
return -1; return -1;
} }
peer->supp_rates_len = merge_byte_arrays(
peer->supp_rates_len = kde->supp_rates_len - 2; peer->supp_rates, sizeof(peer->supp_rates),
if (peer->supp_rates_len > IEEE80211_MAX_SUPP_RATES) kde->supp_rates + 2, kde->supp_rates_len - 2,
peer->supp_rates_len = IEEE80211_MAX_SUPP_RATES; kde->ext_supp_rates + 2, kde->ext_supp_rates_len - 2);
os_memcpy(peer->supp_rates, kde->supp_rates + 2, peer->supp_rates_len);
if (kde->ext_supp_rates) {
int clen = kde->ext_supp_rates_len - 2;
if (peer->supp_rates_len + clen > IEEE80211_MAX_SUPP_RATES)
clen = IEEE80211_MAX_SUPP_RATES - peer->supp_rates_len;
os_memcpy(peer->supp_rates + peer->supp_rates_len,
kde->ext_supp_rates + 2, clen);
peer->supp_rates_len += clen;
}
return 0; return 0;
} }