Skip to content

Commit

Permalink
Fix off by one error in set Bluetooth name command
Browse files Browse the repository at this point in the history
  • Loading branch information
DanTheMan827 authored Jan 25, 2025
1 parent 8a995cd commit c3f61eb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ntag215.js
Original file line number Diff line number Diff line change
Expand Up @@ -980,11 +980,11 @@ function fastRx(data) {

// If the null terminator is not found, set it to the end of the data.
if (nullIdx == -1) {
nullIdx = data.length - 1;
nullIdx = data.length;
}

// Write the name to flash.
if (nullIdx > 1) {
if (nullIdx > 2) {
storage.write(PUCK_NAME_FILE, data.slice(1, nullIdx));
} else {
storage.erase(PUCK_NAME_FILE);
Expand Down

0 comments on commit c3f61eb

Please sign in to comment.