1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00

Fix defects detected by Coverity Scan 2021.12.1: Declaring variable data without initializer

This commit is contained in:
Carles Fernandez 2022-02-17 17:28:34 +01:00
parent 24a9781017
commit 0f65cbeb91
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -33,11 +33,11 @@ boost::system::error_code Rtl_Tcp_Dongle_Info::read(boost::asio::ip::tcp::socket
{
boost::system::error_code ec;
unsigned char data[sizeof(char) * 4 + sizeof(uint32_t) * 2];
std::vector<unsigned char> data(sizeof(char) * 4 + sizeof(uint32_t) * 2);
size_t received_bits = socket.receive(boost::asio::buffer(data), 0, ec);
if (!ec && (received_bits > 0))
{
std::memcpy(magic_, data, 4);
std::memcpy(magic_, data.data(), 4);
uint32_t type;
std::memcpy(&type, &data[4], 4);