aboutsummaryrefslogtreecommitdiffstats
path: root/wlantest/rx_mgmt.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2010-11-12 21:28:43 (GMT)
committerJouni Malinen <j@w1.fi>2010-11-12 21:28:43 (GMT)
commit42e79f82dcb1307349325beef7f52a0a4cac2bf9 (patch)
treeaf9152e048461a7764c73b28a4d830a2f71bfeea /wlantest/rx_mgmt.c
parent2102ecf0b5a844c8e16bef493bd3f767f5ad1684 (diff)
downloadhostap-42e79f82dcb1307349325beef7f52a0a4cac2bf9.zip
hostap-42e79f82dcb1307349325beef7f52a0a4cac2bf9.tar.gz
hostap-42e79f82dcb1307349325beef7f52a0a4cac2bf9.tar.bz2
wlantest: Fix mgmt CCMP decrypt to not crash on failures
Diffstat (limited to 'wlantest/rx_mgmt.c')
-rw-r--r--wlantest/rx_mgmt.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/wlantest/rx_mgmt.c b/wlantest/rx_mgmt.c
index 1b9e041..53a6396 100644
--- a/wlantest/rx_mgmt.c
+++ b/wlantest/rx_mgmt.c
@@ -660,7 +660,7 @@ static u8 * mgmt_ccmp_decrypt(struct wlantest *wt, const u8 *data, size_t len,
struct wlantest_sta *sta;
const struct ieee80211_hdr *hdr;
int keyid;
- u8 *decrypted, *frame;
+ u8 *decrypted, *frame = NULL;
u8 pn[6], *rsc;
hdr = (const struct ieee80211_hdr *) data;
@@ -697,14 +697,14 @@ static u8 * mgmt_ccmp_decrypt(struct wlantest *wt, const u8 *data, size_t len,
}
decrypted = ccmp_decrypt(sta->ptk.tk1, hdr, data + 24, len - 24, dlen);
- if (decrypted)
+ if (decrypted) {
os_memcpy(rsc, pn, 6);
-
- frame = os_malloc(24 + *dlen);
- if (frame) {
- os_memcpy(frame, data, 24);
- os_memcpy(frame + 24, decrypted, *dlen);
- *dlen += 24;
+ frame = os_malloc(24 + *dlen);
+ if (frame) {
+ os_memcpy(frame, data, 24);
+ os_memcpy(frame + 24, decrypted, *dlen);
+ *dlen += 24;
+ }
}
os_free(decrypted);