]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
DPP2: Check conn->ctrl more consistently
authorJouni Malinen <j@w1.fi>
Sun, 28 Apr 2019 17:28:46 +0000 (20:28 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 28 Apr 2019 17:28:46 +0000 (20:28 +0300)
There is no point in checking this pointer against NULL after it has
been dereferenced. Move the check to the beginning of the function.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/common/dpp.c

index b50202f2035746d9758edefac35dcce1a46ade24..8094dfa9f313655f5ad053e86d9b1d440a315c7c 100644 (file)
@@ -9332,6 +9332,9 @@ static int dpp_controller_rx_auth_req(struct dpp_connection *conn,
        u16 r_bootstrap_len, i_bootstrap_len;
        struct dpp_bootstrap_info *own_bi = NULL, *peer_bi = NULL;
 
+       if (!conn->ctrl)
+               return 0;
+
        wpa_printf(MSG_DEBUG, "DPP: Authentication Request");
 
        r_bootstrap = dpp_get_attr(buf, len, DPP_ATTR_R_BOOTSTRAP_KEY_HASH,
@@ -9379,8 +9382,7 @@ static int dpp_controller_rx_auth_req(struct dpp_connection *conn,
                return -1;
        }
 
-       if (conn->ctrl &&
-           dpp_set_configurator(conn->ctrl->global, conn->ctrl->global->msg_ctx,
+       if (dpp_set_configurator(conn->ctrl->global, conn->ctrl->global->msg_ctx,
                                 conn->auth,
                                 conn->ctrl->configurator_params) < 0) {
                dpp_connection_remove(conn);