Browse Source

fix(ble): Ignore out of range profiles

Don't allow selecting a BLE profile that is out of range to avoid
reading/writing past the end of the profiles array.
xmkb
Joel Spadin 4 years ago committed by Pete Johanson
parent
commit
0a9efbf85d
  1. 5
      app/src/ble.c

5
app/src/ble.c

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
#include <device.h>
#include <init.h>
#include <errno.h>
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
@ -250,6 +251,10 @@ static int ble_save_profile() { @@ -250,6 +251,10 @@ static int ble_save_profile() {
}
int zmk_ble_prof_select(uint8_t index) {
if (index >= PROFILE_COUNT) {
return -ERANGE;
}
LOG_DBG("profile %d", index);
if (active_profile == index) {
return 0;

Loading…
Cancel
Save