mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
DtSvc: Coverity (memory corruption)
This commit is contained in:
parent
9751abddff
commit
2d89ad036a
1 changed files with 6 additions and 6 deletions
|
@ -345,7 +345,7 @@ _DtGetDisplayHostName( Display *dp)
|
||||||
return XtNewString(displayHostName);
|
return XtNewString(displayHostName);
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpName = XtMalloc(MAXHOSTNAMELEN + 5);
|
tmpName = XtMalloc(MAXHOSTNAMELEN + 5 + 1);
|
||||||
tmpName[0] = '\0';
|
tmpName[0] = '\0';
|
||||||
|
|
||||||
if ( dp )
|
if ( dp )
|
||||||
|
@ -369,7 +369,8 @@ _DtGetDisplayHostName( Display *dp)
|
||||||
* In the absence of a display pointer, use the
|
* In the absence of a display pointer, use the
|
||||||
* DISPLAY environment variable.
|
* DISPLAY environment variable.
|
||||||
*/
|
*/
|
||||||
strcpy(tmpName,getenv("DISPLAY"));
|
memset(tmpName, 0, (MAXHOSTNAMELEN + 5) + 1);
|
||||||
|
strncpy(tmpName, getenv("DISPLAY"), (MAXHOSTNAMELEN + 5));
|
||||||
if (( tmp = DtStrrchr(tmpName,':') ))
|
if (( tmp = DtStrrchr(tmpName,':') ))
|
||||||
{
|
{
|
||||||
*tmp = '\0';
|
*tmp = '\0';
|
||||||
|
@ -713,10 +714,9 @@ char *_DtGetDtTmpDir(void)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* RWV: is this the right HOME if we've changed user id? */
|
/* RWV: is this the right HOME if we've changed user id? */
|
||||||
dirBuf = XtMalloc(MAXPATHLEN);
|
char *home = getenv("HOME");
|
||||||
strcpy(dirBuf,getenv("HOME"));
|
dirBuf = XtCalloc(1, MAXPATHLEN + 1);
|
||||||
strcat(dirBuf,"/");
|
snprintf(dirBuf, MAXPATHLEN, "%s/%s", home, DtACTION_DTTMPDIR_DEFAULT);
|
||||||
strcat(dirBuf,DtACTION_DTTMPDIR_DEFAULT);
|
|
||||||
DtTmpDirPath = XtNewString(dirBuf);
|
DtTmpDirPath = XtNewString(dirBuf);
|
||||||
XtFree(dirBuf);
|
XtFree(dirBuf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue