mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
DtSvc/DtUtil2: Coverity (memory corruption, moderate)
This commit is contained in:
parent
775008571d
commit
c18f109032
1 changed files with 18 additions and 18 deletions
|
@ -100,15 +100,15 @@ _DtCreateDtDirs(
|
||||||
if ((home =getenv("HOME")) == NULL)
|
if ((home =getenv("HOME")) == NULL)
|
||||||
home = "";
|
home = "";
|
||||||
|
|
||||||
tmpPath = (char *) XtMalloc((MAXPATHLEN + 1) * sizeof(char));
|
tmpPath = XtCalloc(1, MAXPATHLEN + 1);
|
||||||
if(tmpPath == NULL)
|
if(tmpPath == NULL)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the $HOME/.dt directory does not exist, create it
|
* If the $HOME/.dt directory does not exist, create it
|
||||||
*/
|
*/
|
||||||
strcpy(tmpPath, home);
|
strncpy(tmpPath, home, MAXPATHLEN);
|
||||||
strcat(tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY);
|
strncat(tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY, MAXPATHLEN);
|
||||||
|
|
||||||
status = stat(tmpPath, &buf);
|
status = stat(tmpPath, &buf);
|
||||||
if (status == -1) {
|
if (status == -1) {
|
||||||
|
@ -123,8 +123,8 @@ _DtCreateDtDirs(
|
||||||
/*
|
/*
|
||||||
* Create the personal DB directory if it does not exist.
|
* Create the personal DB directory if it does not exist.
|
||||||
*/
|
*/
|
||||||
strcpy(tmpPath, home);
|
strncpy(tmpPath, home, MAXPATHLEN);
|
||||||
strcat(tmpPath, "/" DtPERSONAL_DB_DIRECTORY);
|
strncat(tmpPath, "/" DtPERSONAL_DB_DIRECTORY, MAXPATHLEN);
|
||||||
|
|
||||||
if ((status = stat (tmpPath, &buf)) == -1) {
|
if ((status = stat (tmpPath, &buf)) == -1) {
|
||||||
if ((status = mkdir (tmpPath, 0000)) != -1)
|
if ((status = mkdir (tmpPath, 0000)) != -1)
|
||||||
|
@ -134,8 +134,8 @@ _DtCreateDtDirs(
|
||||||
/*
|
/*
|
||||||
* Create the personal tmp dir if it does not exist.
|
* Create the personal tmp dir if it does not exist.
|
||||||
*/
|
*/
|
||||||
strcpy(tmpPath, home);
|
strncpy(tmpPath, home, MAXPATHLEN);
|
||||||
strcat(tmpPath, "/" DtPERSONAL_TMP_DIRECTORY);
|
strncat(tmpPath, "/" DtPERSONAL_TMP_DIRECTORY, MAXPATHLEN);
|
||||||
|
|
||||||
if ((status = stat (tmpPath, &buf)) == -1) {
|
if ((status = stat (tmpPath, &buf)) == -1) {
|
||||||
if ((status = mkdir (tmpPath, 0000)) != -1)
|
if ((status = mkdir (tmpPath, 0000)) != -1)
|
||||||
|
@ -172,10 +172,10 @@ _DtCreateDtDirs(
|
||||||
*/
|
*/
|
||||||
if ((displayName = GetDisplayName (display)) != NULL) {
|
if ((displayName = GetDisplayName (display)) != NULL) {
|
||||||
|
|
||||||
strcpy (tmpPath, home);
|
strncpy (tmpPath, home, MAXPATHLEN);
|
||||||
strcat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY);
|
strncat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY, MAXPATHLEN);
|
||||||
strcat (tmpPath, "/");
|
strncat (tmpPath, "/", MAXPATHLEN);
|
||||||
strcat (tmpPath, displayName);
|
strncat (tmpPath, displayName, MAXPATHLEN);
|
||||||
|
|
||||||
free(displayName); /* CDExc22771 */
|
free(displayName); /* CDExc22771 */
|
||||||
|
|
||||||
|
@ -214,10 +214,10 @@ _DtCreateDtDirs(
|
||||||
*/
|
*/
|
||||||
if ((displayName = GetDisplayName (display)) != NULL) {
|
if ((displayName = GetDisplayName (display)) != NULL) {
|
||||||
|
|
||||||
strcpy (tmpPath, home);
|
strncpy (tmpPath, home, MAXPATHLEN);
|
||||||
strcat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY);
|
strncat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY, MAXPATHLEN);
|
||||||
strcat (tmpPath, "/");
|
strncat (tmpPath, "/", MAXPATHLEN);
|
||||||
strcat (tmpPath, displayName);
|
strncat (tmpPath, displayName, MAXPATHLEN);
|
||||||
|
|
||||||
free(displayName); /* CDExc22771 */
|
free(displayName); /* CDExc22771 */
|
||||||
|
|
||||||
|
@ -237,9 +237,9 @@ _DtCreateDtDirs(
|
||||||
* If we don't have an old style directory - we check for a sessions
|
* If we don't have an old style directory - we check for a sessions
|
||||||
* directory, and create it if it doesn't exist
|
* directory, and create it if it doesn't exist
|
||||||
*/
|
*/
|
||||||
strcpy (tmpPath, home);
|
strncpy (tmpPath, home, MAXPATHLEN);
|
||||||
strcat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY);
|
strncat (tmpPath, "/" DtPERSONAL_CONFIG_DIRECTORY, MAXPATHLEN);
|
||||||
strcat (tmpPath, "/" DtSM_SESSION_DIRECTORY);
|
strncat (tmpPath, "/" DtSM_SESSION_DIRECTORY, MAXPATHLEN);
|
||||||
|
|
||||||
if ((status = stat(tmpPath, &buf)) == -1) {
|
if ((status = stat(tmpPath, &buf)) == -1) {
|
||||||
if ((status = mkdir(tmpPath, 0000)) == -1) {
|
if ((status = mkdir(tmpPath, 0000)) == -1) {
|
||||||
|
|
Loading…
Reference in a new issue