commit 73dd0602fda0e55ff62dd11b58c11084e7719f38
parent 48f5a051bc098a48f5ab65eb398ab82fa9e80ea5
Author: James Prestwood <james.prestwood@linux.intel.com>
Date: Thu, 10 Jan 2019 13:43:37 -0800
sae: verify peer element for valid point
The return from l_ecc_point_from_data was not being checked for NULL,
which would cause a segfault if the peer sent an invalid point.
This adds a check and fails the protocol if p_element is NULL, as the
spec defines.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/src/sae.c b/src/sae.c
@@ -450,6 +450,10 @@ static void sae_process_commit(struct sae_sm *sm, const uint8_t *from,
sm->p_element = l_ecc_point_from_data(sm->curve, L_ECC_POINT_TYPE_FULL,
ptr, 64);
+ if (!sm->p_element) {
+ reason = MMPDU_REASON_CODE_UNSPECIFIED;
+ goto reject;
+ }
if (l_ecc_scalars_are_equal(sm->p_scalar, sm->scalar) ||
l_ecc_points_are_equal(sm->p_element, sm->element)) {