Skip to content
Snippets Groups Projects
Commit a533feaf authored by Brendan Smith's avatar Brendan Smith Committed by Emmanuel Milou
Browse files

[#4952] Patches for possible buffer overflows

parent 22260ae7
No related branches found
No related tags found
No related merge requests found
......@@ -90,15 +90,15 @@ void getMessageSummary (char * message , const gchar * alias, const gchar * serv
strcat (message, "\n\n");
strcat (message, _ ("Alias"));
sprintf (var, " : %s\n", alias);
snprintf (var, sizeof (var), " : %s\n", alias);
strcat (message, var);
strcat (message, _ ("Server"));
sprintf (var, " : %s\n", server);
snprintf (var, sizeof (var), " : %s\n", server);
strcat (message, var);
strcat (message, _ ("Username"));
sprintf (var, " : %s\n", username);
snprintf (var, sizeof (var), " : %s\n", username);
strcat (message, var);
strcat (message, _ ("Security: "));
......
......@@ -106,7 +106,7 @@ main (int argc, char **argv)
unsigned int iPid = getpid();
char cPid[64], cOldPid[64];
sprintf (cPid,"%d", iPid);
snprintf (cPid, sizeof (cPid), "%d", iPid);
std::string xdg_cache, xdg_env, path;
xdg_cache = std::string (HOMEDIR) + DIR_SEPARATOR_STR + ".cache/";
......@@ -118,11 +118,13 @@ main (int argc, char **argv)
} else
path = xdg_cache;
sprintf (sfldir, "%s", path.c_str ());
// Use safe sprintf (Contribution #4952, Brendan Smith)
snprintf (sfldir, sizeof (sfldir), "%s", path.c_str ());
path = path + "sflphone";
sprintf (homepid, "%s/%s", path.c_str (), PIDFILE);
// Use safe sprintf (Contribution #4952, Brendan Smith)
snprintf (homepid, sizeof (homepid), "%s/%s", path.c_str (), PIDFILE);
if ( (fp = fopen (homepid,"r")) == NULL) {
// Check if $XDG_CACHE_HOME directory exists or not.
......@@ -137,7 +139,7 @@ main (int argc, char **argv)
}
// Then create the sflphone directory inside the $XDG_CACHE_HOME dir
sprintf (sfldir, "%s", path.c_str ());
snprintf (sfldir, sizeof (sfldir), "%s", path.c_str ());
if ( (dir = opendir (sfldir)) == NULL) {
//Create it
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment