1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-11-16 14:54:59 +00:00
This commit is contained in:
Carles Fernandez 2019-08-24 10:02:41 +02:00
commit 8a17224133
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -44,6 +44,7 @@
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include <glog/logging.h> #include <glog/logging.h>
#include <pmt/pmt.h> #include <pmt/pmt.h>
#include <algorithm> // for min
#include <bitset> #include <bitset>
#include <cstddef> // for size_t #include <cstddef> // for size_t
#include <cstdint> #include <cstdint>
@ -593,7 +594,7 @@ private:
inline void encode_header() inline void encode_header()
{ {
char header[header_length + 1] = ""; char header[header_length + 1] = "";
std::snprintf(header, header_length, "GS%4d", static_cast<int>(body_length_)); std::snprintf(header, header_length + 1, "GS%4d", std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)));
std::memcpy(data_, header, header_length); std::memcpy(data_, header, header_length);
} }