mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-29 18:53:14 +00:00
trezor: fix potential use of uninitialized memory
CID 1446575
This commit is contained in:
parent
7499837a6f
commit
7b6d959596
1 changed files with 7 additions and 2 deletions
|
@ -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 a new issue