]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - wlantest/tkip.c
Use os_memdup()
[thirdparty/hostap.git] / wlantest / tkip.c
index 63366d5e21558812c3d5f4361e207cb26858596b..d616d4308ccd7632c430ca0db4247951eebde9c3 100644 (file)
@@ -318,10 +318,9 @@ u8 * tkip_decrypt(const u8 *tk, const struct ieee80211_hdr *hdr,
        wpa_hexdump(MSG_EXCESSIVE, "TKIP RC4KEY", rc4key, sizeof(rc4key));
 
        plain_len = data_len - 8;
-       plain = os_malloc(plain_len);
+       plain = os_memdup(data + 8, plain_len);
        if (plain == NULL)
                return NULL;
-       os_memcpy(plain, data + 8, plain_len);
        wep_crypt(rc4key, plain, plain_len);
 
        icv = crc32(plain, plain_len - 4);