]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OWE: Clean up pointer check in a testing code path
authorAshok Ponnaiah <aponnaia@codeaurora.org>
Mon, 5 Mar 2018 05:29:18 +0000 (10:59 +0530)
committerJouni Malinen <j@w1.fi>
Mon, 19 Mar 2018 17:08:34 +0000 (19:08 +0200)
Check wpa_auth_write_assoc_resp_owe() return value to keep static
analyzers happier. The code path where this could happen is not really
reachable due to the separate hapd->conf->own_ie_override check and
wpa_auth_write_assoc_resp_owe() returning NULL only in an error case in
the override path. Furthermore, clean up the pointer return value to use
a proper pointer (NULL vs. 0).

Signed-off-by: Ashok Ponnaiah <aponnaia@codeaurora.org>
src/ap/ieee802_11.c
src/ap/wpa_auth_ie.c

index fcfe3362146aaf52c9ea46abc9107e31a340c2c7..ec57f32ee6b50b7fbd2e104708d2842d75d37b00 100644 (file)
@@ -3021,7 +3021,7 @@ u8 * owe_assoc_req_process(struct hostapd_data *hapd, struct sta_info *sta,
        owe_buf = wpa_auth_write_assoc_resp_owe(sta->wpa_sm, owe_buf,
                                                owe_buf_len, NULL, 0);
 
-       if (sta->owe_ecdh) {
+       if (sta->owe_ecdh && owe_buf) {
                struct wpabuf *pub;
 
                pub = crypto_ecdh_get_pubkey(sta->owe_ecdh, 0);
index 28db9527af0b929a42cc3eac12f8ff6b6ad370ab..e4610d1a2073308650432af55c4bed46788eb9c5 100644 (file)
@@ -1042,7 +1042,7 @@ u8 * wpa_auth_write_assoc_resp_owe(struct wpa_state_machine *sm,
 #ifdef CONFIG_TESTING_OPTIONS
        if (conf->own_ie_override_len) {
                if (max_len < conf->own_ie_override_len)
-                       return 0;
+                       return NULL;
                wpa_hexdump(MSG_DEBUG, "WPA: Forced own IE(s) for testing",
                            conf->own_ie_override, conf->own_ie_override_len);
                os_memcpy(pos, conf->own_ie_override,