]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Fix bip_protect() memory allocation
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 14 Mar 2016 16:42:46 +0000 (18:42 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 14 Mar 2016 16:42:46 +0000 (18:42 +0200)
The addition operator is of higher precedence than the ternary
conditional and the construction here needs to use parentheses to
calculate the buffer length properly when generating test frames with
BIP protection.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
wlantest/bip.c

index bda8036c5ec534849b35c5c1b7ae16e34594769c..c73a15c98aab96cec158b6a00faf6dfb684a5592 100644 (file)
@@ -23,7 +23,7 @@ u8 * bip_protect(const u8 *igtk, size_t igtk_len, u8 *frame, size_t len,
        struct ieee80211_hdr *hdr;
        size_t plen;
 
-       plen = len + igtk_len == 32 ? 26 : 18;
+       plen = len + (igtk_len == 32 ? 26 : 18);
        prot = os_malloc(plen);
        if (prot == NULL)
                return NULL;