1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-08-30 01:17:59 +00:00

Fix undefined behavior when computing sats array size in update_sdr_gnss_packet

This commit is contained in:
Carles Fernandez
2025-08-08 20:34:18 +02:00
parent 6c849dd43b
commit e4afdc27c6

View File

@@ -102,9 +102,9 @@ void An_Packet_Printer::update_sdr_gnss_packet(sdr_gnss_packet_t* _packet, const
std::map<int, Gnss_Synchro>::const_iterator gnss_observables_iter;
uint8_t num_gps_sats = 0;
uint8_t num_gal_sats = 0;
int index = 0;
std::size_t index = 0;
bool fix_3d = pvt->is_valid_position();
const int max_reported_sats = *(&_packet->sats + 1) - _packet->sats;
const auto max_reported_sats = std::size(_packet->sats);
for (gnss_observables_iter = gnss_observables_map.cbegin();
gnss_observables_iter != gnss_observables_map.cend();