Skip to content

Commit

Permalink
bluetooth: fix pincode copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
bramoosterhuis committed Feb 1, 2024
1 parent ae32d9b commit 4693c4c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/bluetooth/HCISocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1245,8 +1245,8 @@ uint32_t ManagementSocket::UserPINCodeReply(const Address& remote, const Address
Management::UserPINCodeReply command(_deviceId);
command->addr.bdaddr = *remote.Data();
command->addr.type = type;
command->pin_len = std::max(pinCode.length(), sizeof(command->pin_code));
::strncpy(reinterpret_cast<char*>(command->pin_code), pinCode.c_str(), sizeof(command->pin_code));
command->pin_len = std::min(pinCode.length(), sizeof(command->pin_code));
::memcpy(command->pin_code, pinCode.c_str(), std::min(pinCode.length(), sizeof(command->pin_code)));
result = Exchange(MANAGMENT_TIMEOUT, command, command);
commandResult = command.Result();
} else {
Expand Down

0 comments on commit 4693c4c

Please sign in to comment.