Skip to content

Commit 9081617

Browse files
committed
fix(split): Fix an off-by-one error in split svc.
* Properly check end of behavior device string for null terminator.
1 parent 415c6db commit 9081617

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/src/split/bluetooth/service.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static ssize_t split_svc_run_behavior(struct bt_conn *conn, const struct bt_gatt
5252
// 1: We've gotten all the position/state/param data.
5353
// 2: We have a null terminated string for the behavior device label.
5454
if ((end_addr > sizeof(struct zmk_split_run_behavior_data)) &&
55-
payload->behavior_dev[end_addr - sizeof(struct zmk_split_run_behavior_data)] == '\0') {
55+
payload->behavior_dev[end_addr - sizeof(struct zmk_split_run_behavior_data) - 1] == '\0') {
5656
struct zmk_behavior_binding binding = {
5757
.param1 = payload->data.param1,
5858
.param2 = payload->data.param2,

0 commit comments

Comments
 (0)