From b8700eaaa1e24837d6b9ff60430d706c555f9a2f Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Sun, 30 Jan 2022 05:32:12 +0000 Subject: [PATCH] fix(split): Fix an off-by-one error in split svc. * Properly check end of behavior device string for null terminator. --- app/src/split/bluetooth/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/split/bluetooth/service.c b/app/src/split/bluetooth/service.c index 3b860197..ca192d7d 100644 --- a/app/src/split/bluetooth/service.c +++ b/app/src/split/bluetooth/service.c @@ -52,7 +52,7 @@ static ssize_t split_svc_run_behavior(struct bt_conn *conn, const struct bt_gatt // 1: We've gotten all the position/state/param data. // 2: We have a null terminated string for the behavior device label. if ((end_addr > sizeof(struct zmk_split_run_behavior_data)) && - payload->behavior_dev[end_addr - sizeof(struct zmk_split_run_behavior_data)] == '\0') { + payload->behavior_dev[end_addr - sizeof(struct zmk_split_run_behavior_data) - 1] == '\0') { struct zmk_behavior_binding binding = { .param1 = payload->data.param1, .param2 = payload->data.param2,