mirror of
https://github.com/monero-project/monero.git
synced 2024-12-25 22:49:24 -05:00
trezor: fix potential use of uninitialized memory
CID 1446575
This commit is contained in:
parent
7499837a6f
commit
7b6d959596
@ -573,8 +573,13 @@ namespace trezor{
|
|||||||
std::string req = "PINGPING";
|
std::string req = "PINGPING";
|
||||||
char res[8];
|
char res[8];
|
||||||
|
|
||||||
m_socket->send_to(boost::asio::buffer(req.c_str(), req.size()), m_endpoint);
|
const auto written = m_socket->send_to(boost::asio::buffer(req.c_str(), req.size()), m_endpoint);
|
||||||
receive(res, 8, nullptr, false, timeout);
|
if (written != req.size())
|
||||||
|
return false;
|
||||||
|
memset(res, 0, sizeof(res));
|
||||||
|
const auto received = receive(res, 8, nullptr, false, timeout);
|
||||||
|
if (received != 8)
|
||||||
|
return false;
|
||||||
|
|
||||||
return memcmp(res, "PONGPONG", 8) == 0;
|
return memcmp(res, "PONGPONG", 8) == 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user