Skip to content

Commit 11bfc2e

Browse files
Merge branch 'main' into fix/CompositorBuffer--do-not-initialize-members-afer-mmap
2 parents 60590b9 + 17f66a1 commit 11bfc2e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Source/bluetooth/HCISocket.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,8 +1245,8 @@ uint32_t ManagementSocket::UserPINCodeReply(const Address& remote, const Address
12451245
Management::UserPINCodeReply command(_deviceId);
12461246
command->addr.bdaddr = *remote.Data();
12471247
command->addr.type = type;
1248-
command->pin_len = std::max(pinCode.length(), sizeof(command->pin_code));
1249-
::strncpy(reinterpret_cast<char*>(command->pin_code), pinCode.c_str(), sizeof(command->pin_code));
1248+
command->pin_len = std::min(pinCode.length(), sizeof(command->pin_code));
1249+
::memcpy(command->pin_code, pinCode.c_str(), std::min(pinCode.length(), sizeof(command->pin_code)));
12501250
result = Exchange(MANAGMENT_TIMEOUT, command, command);
12511251
commandResult = command.Result();
12521252
} else {

0 commit comments

Comments
 (0)