]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP: Check own_bi/peer_bi pointers more consistently
authorJouni Malinen <jouni@codeaurora.org>
Fri, 30 Nov 2018 15:57:35 +0000 (17:57 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 30 Nov 2018 19:28:19 +0000 (21:28 +0200)
This gets rid of smatch warnings about a dereference before check.

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
src/common/dpp.c

index e7008c0bafcf66e0a77158890d8778bb92513f0a..d50b5a739499d52fe91b39242e5ce3c9db2a7c9f 100644 (file)
@@ -3457,7 +3457,7 @@ dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
        }
 #endif /* CONFIG_TESTING_OPTIONS */
 
-       if (!auth->initiator) {
+       if (!auth->initiator || !auth->peer_bi) {
                dpp_auth_fail(auth, "Unexpected Authentication Response");
                return NULL;
        }
@@ -3638,7 +3638,7 @@ dpp_auth_resp_rx(struct dpp_authentication *auth, const u8 *hdr,
                goto fail;
        }
 
-       if (auth->own_bi && auth->peer_bi) {
+       if (auth->own_bi) {
                /* Mutual authentication */
                if (dpp_auth_derive_l_initiator(auth) < 0)
                        goto fail;
@@ -3846,7 +3846,7 @@ int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr,
        }
 #endif /* CONFIG_TESTING_OPTIONS */
 
-       if (auth->initiator) {
+       if (auth->initiator || !auth->own_bi) {
                dpp_auth_fail(auth, "Unexpected Authentication Confirm");
                return -1;
        }
@@ -3904,7 +3904,7 @@ int dpp_auth_conf_rx(struct dpp_authentication *auth, const u8 *hdr,
                                      "Initiator Bootstrapping Key Hash mismatch");
                        return -1;
                }
-       } else if (auth->own_bi && auth->peer_bi) {
+       } else if (auth->peer_bi) {
                /* Mutual authentication and peer did not include its
                 * Bootstrapping Key Hash attribute. */
                dpp_auth_fail(auth,