1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-01-28 18:04:51 +00:00

Avoid string truncation

This commit is contained in:
Carles Fernandez 2019-08-24 12:17:53 +02:00
parent d9a655efce
commit d36e9e431c
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 5 additions and 5 deletions

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--)
{