diff --git a/src/algorithms/libs/rtklib/rtklib_stream.cc b/src/algorithms/libs/rtklib/rtklib_stream.cc index b301cfb1b..2810bc6cc 100644 --- a/src/algorithms/libs/rtklib/rtklib_stream.cc +++ b/src/algorithms/libs/rtklib/rtklib_stream.cc @@ -1493,7 +1493,6 @@ void decodeftppath(const char *path, char *addr, char *file, char *user, *q = '\0'; if (passwd) strcpy(passwd, q + 1); } - if (*q != 0) *q = '\0'; if (user) strcpy(user, buff); } else diff --git a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc index 60fb651c0..58db3bac1 100644 --- a/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc +++ b/src/algorithms/libs/volk_gnsssdr_module/volk_gnsssdr/lib/qa_utils.cc @@ -565,6 +565,11 @@ bool run_volk_gnsssdr_tests(volk_gnsssdr_func_desc_t desc, std::cerr << " - " << name << std::endl; return false; } + catch (std::string s) + { + std::cerr << "Error: " << s << std::endl; + return false; + } //pull the input scalars into their own vector std::vector inputsc; diff --git a/src/tests/common-files/gnuplot_i.h b/src/tests/common-files/gnuplot_i.h index 0c9e282a7..6bb6d7d4f 100644 --- a/src/tests/common-files/gnuplot_i.h +++ b/src/tests/common-files/gnuplot_i.h @@ -56,6 +56,7 @@ #include #include #include // for getenv() +#include // for strncpy #include #include // for std::list @@ -1962,44 +1963,48 @@ bool Gnuplot::get_program_path() char *path; // Retrieves a C string containing the value of environment variable PATH path = std::getenv("PATH"); - - if (path == NULL || std::char_traits::length(path) > 4096 * sizeof(char)) + char secured_path[4096]; + size_t len = strlen(path); + if (path && len < 4046 * sizeof(char)) { - throw GnuplotException("Path is not set"); + strncpy(secured_path, path, len); } else { - std::list ls; - std::string path_str(path); - - //split path (one long string) into list ls of strings -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) - stringtok(ls, path_str, ";"); -#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) - stringtok(ls, path_str, ":"); -#endif - - // scan list for Gnuplot program files - for (std::list::const_iterator i = ls.begin(); - i != ls.end(); ++i) - { - tmp = (*i) + "/" + Gnuplot::m_sGNUPlotFileName; -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) - if (Gnuplot::file_exists(tmp, 0)) // check existence -#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) - if (Gnuplot::file_exists(tmp, 1)) // check existence and execution permission -#endif - { - Gnuplot::m_sGNUPlotPath = *i; // set m_sGNUPlotPath - return true; - } - } - - tmp = "Can't find gnuplot neither in PATH nor in \"" + - Gnuplot::m_sGNUPlotPath + "\""; - Gnuplot::m_sGNUPlotPath = ""; - throw GnuplotException(tmp); + throw GnuplotException("Path is not set or it is too long"); } + secured_path[len] = '\0'; + std::string path_str(secured_path); + + std::list ls; + + //split path (one long string) into list ls of strings +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) + stringtok(ls, path_str, ";"); +#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) + stringtok(ls, path_str, ":"); +#endif + + // scan list for Gnuplot program files + for (std::list::const_iterator i = ls.begin(); + i != ls.end(); ++i) + { + tmp = (*i) + "/" + Gnuplot::m_sGNUPlotFileName; +#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) + if (Gnuplot::file_exists(tmp, 0)) // check existence +#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) + if (Gnuplot::file_exists(tmp, 1)) // check existence and execution permission +#endif + { + Gnuplot::m_sGNUPlotPath = *i; // set m_sGNUPlotPath + return true; + } + } + + tmp = "Can't find gnuplot neither in PATH nor in \"" + + Gnuplot::m_sGNUPlotPath + "\""; + Gnuplot::m_sGNUPlotPath = ""; + throw GnuplotException(tmp); } diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index cbdb6d28b..6467dac25 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -477,7 +477,19 @@ int main(int argc, char** argv) if (global_gps_ephemeris_map.size() > 0) { std::map Eph_map; - Eph_map = global_gps_ephemeris_map.get_map_copy(); + try + { + Eph_map = global_gps_ephemeris_map.get_map_copy(); + } + catch (const boost::exception& e) + { + std::cout << "Exception in getting Global ephemeris map" << std::endl; + delete acquisition; + delete gnss_synchro; + google::ShutDownCommandLineFlags(); + std::cout << "GNSS-SDR Front-end calibration program ended." << std::endl; + return 0; + } current_TOW = Eph_map.begin()->second.d_TOW; time_t t = utc_time(Eph_map.begin()->second.i_GPS_week, (long int)current_TOW);