mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
dtsession: A few extra snprintf's for buffer safety
This commit is contained in:
parent
e14e74231c
commit
f2c6a48d72
3 changed files with 8 additions and 8 deletions
|
@ -1106,7 +1106,7 @@ SetSavePath(
|
|||
* runs a Current session and saves the session.
|
||||
*/
|
||||
strcpy (savedDir, smGD.clientPath);
|
||||
sprintf(smGD.etcPath, "%s.%s", smGD.clientPath, SM_OLD_EXTENSION);
|
||||
snprintf(smGD.etcPath, sizeof(smGD.etcPath), "%s.%s", smGD.clientPath, SM_OLD_EXTENSION);
|
||||
status = stat(smGD.etcPath, &buf);
|
||||
if(status == 0)
|
||||
{
|
||||
|
@ -1180,7 +1180,7 @@ SetSavePath(
|
|||
*/
|
||||
char * tmpName;
|
||||
|
||||
sprintf(smGD.etcPath, "%s.%s", smGD.clientPath, SM_OLD_EXTENSION);
|
||||
snprintf(smGD.etcPath, sizeof(smGD.etcPath), "%s.%s", smGD.clientPath, SM_OLD_EXTENSION);
|
||||
status = stat(smGD.etcPath, &buf);
|
||||
if(status == 0)
|
||||
{
|
||||
|
@ -1189,7 +1189,7 @@ SetSavePath(
|
|||
len = strlen(smGD.savePath) + strlen(smGD.restoreSession)
|
||||
+ strlen("XXXXXX") + 3;
|
||||
tmpName = (char *) XtCalloc(1, len);
|
||||
sprintf(tmpName, "%s/%s.XXXXXX", smGD.savePath,
|
||||
snprintf(tmpName, len, "%s/%s.XXXXXX", smGD.savePath,
|
||||
smGD.restoreSession);
|
||||
|
||||
strcpy (savedOldDir, smGD.etcPath);
|
||||
|
@ -1702,7 +1702,7 @@ TrimErrorlog( void )
|
|||
*/
|
||||
if (len + strlen(DtERRORLOG_FILE) > MAXPATHLEN)
|
||||
checkPath1 = SM_REALLOC(savePath, len + strlen(DtERRORLOG_FILE));
|
||||
sprintf(checkPath1, "%s/%s", savePath, DtERRORLOG_FILE);
|
||||
snprintf(checkPath1, len + strlen(DtERRORLOG_FILE), "%s/%s", savePath, DtERRORLOG_FILE);
|
||||
|
||||
status = stat(checkPath1, &buf);
|
||||
if((status != -1) && (buf.st_size > 0))
|
||||
|
|
|
@ -3512,7 +3512,7 @@ StartClient(
|
|||
{
|
||||
int slen = strlen(tstr) + 1;
|
||||
defaultCwd = XtCalloc(1, slen);
|
||||
strncpy(defaultCwd, tstr, slen - 1);
|
||||
snprintf(defaultCwd, slen, "%s", tstr);
|
||||
}
|
||||
else
|
||||
defaultCwd = getcwd (NULL, MAXPATHLEN + 1);
|
||||
|
|
|
@ -238,10 +238,10 @@ Boolean InitXSMP ( )
|
|||
if (!env) {
|
||||
free (networkIds);
|
||||
PostXSMPFailureDialog (XSMP_FAILURE_MALLOC, False);
|
||||
}
|
||||
|
||||
} else {
|
||||
(void) sprintf (env, "%s=%s", SM_SESSION_MANAGER, networkIds);
|
||||
(void) putenv (env);
|
||||
}
|
||||
|
||||
PutSessionManagerOnRootWindow (networkIds);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue