1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-11 18:50:37 +00:00

More minor fixes (#23)

* Clang Tidy fixes

* Fix defects detected by Coverity Scan

* Fix for OpenSSL 1.0

---------

Co-authored-by: cesaaargm <cesare.martinez@proton.me>
This commit is contained in:
Carles Fernandez 2024-08-08 09:33:48 +02:00 committed by GitHub
parent 5a6d19be70
commit 98f1cdfb6b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -292,7 +292,7 @@ void osnma_msg_receiver::process_osnma_message(const std::shared_ptr<OSNMA_msg>&
// step 2 , start using new chain
d_flag_PK_revocation = false;
uint32_t final_GST = d_helper->compute_gst(osnma_msg->WN_sf0, osnma_msg->TOW_sf0);
double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600;
double duration_hours = (final_GST - d_GST_PKR_PKREV_start) / 3600.0;
LOG(INFO) << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"
<< ", Duration=" << duration_hours << "h";
std::cout << "Galileo OSNMA: Public Key Revocation :: Finished at GST=[" << osnma_msg->WN_sf0 << " " << osnma_msg->TOW_sf0 << "]"
@ -797,9 +797,9 @@ void osnma_msg_receiver::read_mack_header()
{
lt_bits = it->second;
}
if (lt_bits == 0)
if (lt_bits < 16)
{
return; // C: TODO if Tag length is 0, what is the action? no verification possible of NavData for sure.
return; // The 16 is to avoid negative shifts if shorter tags were defined
}
uint16_t macseq = 0;
uint8_t cop = 0;
@ -1330,7 +1330,7 @@ bool osnma_msg_receiver::verify_tag(Tag& tag) const
{
lt_bits = it2->second;
}
if (lt_bits == 0)
if (lt_bits < 16)
{
return false;
}

View File

@ -1370,7 +1370,11 @@ bool Gnss_Crypto::readPublicKeyFromCRT(const std::string& crtFilePath)
gnutls_pubkey_deinit(pubkey);
#else // OpenSSL
// Read certificate
#if !(USE_OPENSSL_3 || USE_OPENSSL_111)
BIO* bio = BIO_new_mem_buf(const_cast<unsigned char*>(buffer.data()), buffer.size());
#else
BIO* bio = BIO_new_mem_buf(buffer.data(), buffer.size());
#endif
if (!bio)
{
LOG(WARNING) << "OpenSSL: Unable to create BIO for file: " << crtFilePath;