From b93a0ce7bdf32ec434e6d184e3a129599532e321 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sun, 28 Apr 2019 20:28:46 +0300 Subject: [PATCH] DPP2: Check conn->ctrl more consistently 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 --- src/common/dpp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/common/dpp.c b/src/common/dpp.c index b50202f20..8094dfa9f 100644 --- a/src/common/dpp.c +++ b/src/common/dpp.c @@ -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);