mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-15 12:40:35 +00:00
Avoid dereference before null check
This commit is contained in:
parent
bdce3c20d1
commit
bc86d7d665
@ -1965,7 +1965,7 @@ bool Gnuplot::get_program_path()
|
|||||||
path = std::getenv("PATH");
|
path = std::getenv("PATH");
|
||||||
char secured_path[4096];
|
char secured_path[4096];
|
||||||
size_t len = strlen(path);
|
size_t len = strlen(path);
|
||||||
if (path && len < 4046 * sizeof(char))
|
if (len > 0 && len < 4046 * sizeof(char))
|
||||||
{
|
{
|
||||||
strncpy(secured_path, path, sizeof(secured_path));
|
strncpy(secured_path, path, sizeof(secured_path));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user