mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-04-02 16:57:03 +00:00
Fix some truncation warnings
This commit is contained in:
parent
6004b8f901
commit
b99d1afb36
@ -165,16 +165,17 @@ void readionexdcb(FILE *fp, double *dcb, double *rms)
|
||||
|
||||
if (strstr(label, "PRN / BIAS / RMS") == label)
|
||||
{
|
||||
strncpy(id, buff + 3, 3);
|
||||
id[3] = '\0';
|
||||
|
||||
if (!(sat = satid2no(id)))
|
||||
int ret = std::snprintf(id, 3, "%s", buff + 3);
|
||||
if (ret >= 0 && ret < 3)
|
||||
{
|
||||
trace(2, "ionex invalid satellite: %s\n", id);
|
||||
continue;
|
||||
if (!(sat = satid2no(id)))
|
||||
{
|
||||
trace(2, "ionex invalid satellite: %s\n", id);
|
||||
continue;
|
||||
}
|
||||
dcb[sat - 1] = str2num(buff, 6, 10);
|
||||
rms[sat - 1] = str2num(buff, 16, 10);
|
||||
}
|
||||
dcb[sat - 1] = str2num(buff, 6, 10);
|
||||
rms[sat - 1] = str2num(buff, 16, 10);
|
||||
}
|
||||
else if (strstr(label, "END OF AUX DATA") == label)
|
||||
{
|
||||
|
@ -123,8 +123,11 @@ int readsp3h(FILE *fp, gtime_t *time, char *type, int *sats,
|
||||
}
|
||||
else if (i == 12)
|
||||
{
|
||||
strncpy(tsys, buff + 9, 3);
|
||||
tsys[3] = '\0';
|
||||
int ret = std::snprintf(tsys, 3, "%s", buff + 9);
|
||||
if (ret < 0 || ret > 3)
|
||||
{
|
||||
trace(3, "Error reading sp3 header\n")
|
||||
}
|
||||
}
|
||||
else if (i == 14)
|
||||
{
|
||||
|
@ -2847,11 +2847,13 @@ int readantex(const char *file, pcvs_t *pcvs)
|
||||
{
|
||||
strncpy(pcv.type, buff, 20); // MAXANT (64)
|
||||
pcv.type[20] = '\0';
|
||||
strncpy(pcv.code, buff + 20, 20); // MAXANT (64)
|
||||
pcv.code[20] = '\0';
|
||||
if (!strncmp(pcv.code + 3, " ", 8))
|
||||
int ret = std::snprintf(pcv.code, 20, "%s", buff + 20); // MAXANT (64)
|
||||
if (ret >= 0 && ret < 20)
|
||||
{
|
||||
pcv.sat = satid2no(pcv.code);
|
||||
if (!strncmp(pcv.code + 3, " ", 8))
|
||||
{
|
||||
pcv.sat = satid2no(pcv.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (strstr(buff + 60, "VALID FROM"))
|
||||
|
@ -795,8 +795,11 @@ void decodetcppath(const char *path, char *addr, char *port, char *user,
|
||||
}
|
||||
if (addr)
|
||||
{
|
||||
std::strncpy(addr, p, 256);
|
||||
addr[255] = '\0';
|
||||
int ret = std::snprintf(addr, 256, "%s", p);
|
||||
if (ret < 0 || ret >= 256)
|
||||
{
|
||||
tracet(1, "error reading address");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1077,8 +1080,7 @@ void updatetcpsvr(tcpsvr_t *tcpsvr, char *msg)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
std::strncpy(saddr, tcpsvr->cli[i].saddr, 256);
|
||||
saddr[255] = '\0';
|
||||
std::snprintf(saddr, 256, "%s", tcpsvr->cli[i].saddr);
|
||||
n++;
|
||||
}
|
||||
if (n == 0)
|
||||
@ -1968,8 +1970,7 @@ void *ftpthread(void *arg)
|
||||
}
|
||||
if (fs::exists(tmpfile))
|
||||
{
|
||||
std::strncpy(ftp->local, tmpfile.c_str(), 1024);
|
||||
ftp->local[1023] = '\0';
|
||||
std::snprintf(ftp->local, 1024, "%s", tmpfile.c_str());
|
||||
tracet(3, "ftpthread: file exists %s\n", ftp->local);
|
||||
ftp->state = 2;
|
||||
return nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user