mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-10-25 20:47:39 +00:00
Avoid string truncation
This commit is contained in:
@@ -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--)
|
||||
{
|
||||
|
||||
@@ -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--)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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--)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user