Skip to content

Commit 14e6e7b

Browse files
committed
bluetooth: services: ras: rreq: Check for aborted subevent
In the RAS spec if the mode has bit 7 set then the step is aborted, check for this in data parse function. Signed-off-by: Sean Madigan <[email protected]>
1 parent 4280720 commit 14e6e7b

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

subsys/bluetooth/services/ras/rreq/ras_rreq.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,7 @@ void bt_ras_rreq_rd_subevent_data_parse(struct net_buf_simple *peer_ranging_data
896896
if (local_step_data_buf->len < sizeof(struct bt_le_cs_subevent_step) ||
897897
peer_ranging_data_buf->len < sizeof(struct ras_rd_cs_subevent_step)) {
898898
LOG_WRN("Step data appears malformed.");
899+
return;
899900
}
900901

901902
local_step.mode = net_buf_simple_pull_u8(local_step_data_buf);
@@ -921,8 +922,18 @@ void bt_ras_rreq_rd_subevent_data_parse(struct net_buf_simple *peer_ranging_data
921922

922923
peer_step.data_len = local_step.data_len;
923924

925+
if (peer_step.mode & BIT(7)) {
926+
/* From RAS spec:
927+
* Bit 7: 1 means Aborted, 0 means Success
928+
* If the Step is aborted and bit 7 is set to 1, then bits 0-6 do
929+
* not contain any valid data
930+
*/
931+
LOG_INF("Peer step aborted");
932+
return;
933+
}
934+
924935
if (peer_step.mode == 0) {
925-
/* Only occassion where peer step mode length is not equal to local
936+
/* Only occasion where peer step mode length is not equal to local
926937
* step mode length is mode 0 steps.
927938
*/
928939
peer_step.data_len =

0 commit comments

Comments
 (0)