Bluetooth: mesh: Fail provisioning when RFU values are used

When Public Key field is set to RFU value then we should send
Provisioning Fail with Invalid Format error.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
This commit is contained in:
Michał Narajowski 2021-09-02 12:58:08 +02:00 committed by Anas Nashif
parent 8ca8280cc3
commit f51cf9ab86

View file

@ -137,9 +137,9 @@ static void prov_start(const uint8_t *data)
return;
}
if (data[1] == PUB_KEY_OOB &&
!(IS_ENABLED(CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY) &&
bt_mesh_prov->public_key_be)) {
if (data[1] > PUB_KEY_OOB ||
(data[1] == PUB_KEY_OOB &&
(!IS_ENABLED(CONFIG_BT_MESH_PROV_OOB_PUBLIC_KEY) || !bt_mesh_prov->public_key_be))) {
BT_ERR("Invalid public key type: 0x%02x", data[1]);
prov_fail(PROV_ERR_NVAL_FMT);
return;