replaced sprintf -> snprintf throughout.

This commit is contained in:
2022-11-05 20:16:44 +01:00
parent eb63f5862b
commit e32aa61643
27 changed files with 120 additions and 120 deletions

View File

@@ -103,7 +103,7 @@ PMuppStartupHandler::PMuppStartupHandler()
// check if the startup file is found under $HOME/.musrfit/mupp
home = getenv("HOME");
if (home != 0) {
sprintf(startup_path_name, "%s/.musrfit/mupp/mupp_startup.xml", home);
snprintf(startup_path_name, sizeof(startup_path_name), "%s/.musrfit/mupp/mupp_startup.xml", home);
if (StartupFileExists(startup_path_name)) {
fStartupFilePath = TString(startup_path_name);
fStartupFileFound = true;

View File

@@ -62,7 +62,7 @@ namespace mupp
Iterator line_start = get_pos(err_pos, line);
const char *homeStr = getenv("HOME");
char fln[1024];
sprintf(fln, "%s/.musrfit/mupp/mupp_err.log", homeStr);
snprintf(fln, sizeof(fln), "%s/.musrfit/mupp/mupp_err.log", homeStr);
std::ofstream fout(fln, std::ofstream::app);
if (err_pos != last) {
fout << message << what << ':' << std::endl;