]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
UBSan: Avoid unnecessary warning
authorJouni Malinen <j@w1.fi>
Sat, 23 Feb 2019 12:03:59 +0000 (14:03 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 25 Feb 2019 17:48:49 +0000 (19:48 +0200)
elems->mic might be NULL here, so do not try to decrement it by 2 even
if the result is not used anywhere due to a latter check for elems->mic
being NULL.

mesh_rsn.c:646:20: runtime error: pointer index expression with base 0x000000000000 overflowed to 0xfffffffffffffffe

Signed-off-by: Jouni Malinen <j@w1.fi>
wpa_supplicant/mesh_rsn.c

index 64fc52ba1e6de7bca7a04db1d32e187dcbed6d08..174011b5765c035be4172594311b17bd8d93db9a 100644 (file)
@@ -643,7 +643,7 @@ int mesh_rsn_process_ampe(struct wpa_supplicant *wpa_s, struct sta_info *sta,
        size_t crypt_len;
        const u8 *aad[] = { sta->addr, wpa_s->own_addr, cat };
        const size_t aad_len[] = { ETH_ALEN, ETH_ALEN,
-                                  (elems->mic - 2) - cat };
+                                  elems->mic ? (elems->mic - 2) - cat : 0 };
        size_t key_len;
 
        if (!sta->sae) {