1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-14 12:10:34 +00:00
This commit is contained in:
Carles Fernandez 2019-08-24 12:19:08 +02:00
commit b0c1c26b3e
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
5 changed files with 6 additions and 10 deletions

View File

@ -594,11 +594,7 @@ private:
inline void encode_header()
{
char header[header_length + 1] = "";
int num_chars = std::snprintf(header, header_length + 1, "GS%4d", std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)));
if ((num_chars <= 0) or (num_chars > header_length))
{
// avoid Wformat-truncation warning
}
std::snprintf(header, header_length + 1, "GS%4d", std::max(std::min(static_cast<int>(body_length_), static_cast<int>(max_body_length)), 0));
std::memcpy(data_, header, header_length);
}

View File

@ -463,7 +463,7 @@ void readtec(const char *file, nav_t *nav, int opt)
}
for (i = 0; i < MAXEXFILE; i++)
{
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
if (!(efiles[i] = static_cast<char *>(malloc(MAXSTRPATH + 255))))
{
for (i--; i >= 0; i--)
{

View File

@ -420,7 +420,7 @@ void readsp3(const char *file, nav_t *nav, int opt)
for (i = 0; i < MAXEXFILE; i++)
{
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
if (!(efiles[i] = static_cast<char *>(malloc(MAXSTRPATH + 255))))
{
for (i--; i >= 0; i--)
{
@ -601,7 +601,7 @@ int readdcb(const char *file, nav_t *nav, const sta_t *sta)
}
for (i = 0; i < MAXEXFILE; i++)
{
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
if (!(efiles[i] = static_cast<char *>(malloc(MAXSTRPATH + 255))))
{
for (i--; i >= 0; i--)
{

View File

@ -5278,7 +5278,7 @@ int expath(const char *path, char *paths[], int nmax)
}
if (p && n < nmax)
{
std::snprintf(paths[n++], MAXSTRPATH, "%s%s", dir, d->d_name);
std::snprintf(paths[n++], MAXSTRPATH + 255, "%s%s", dir, d->d_name);
}
}
closedir(dp);

View File

@ -782,7 +782,7 @@ int sbsreadmsgt(const char *file, int sel, gtime_t ts, gtime_t te,
for (i = 0; i < MAXEXFILE; i++)
{
if (!(efiles[i] = static_cast<char *>(malloc(1024))))
if (!(efiles[i] = static_cast<char *>(malloc(MAXSTRPATH + 255))))
{
for (i--; i >= 0; i--)
{