1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

DtSvc: Coverity (memory corruption)

This commit is contained in:
Jon Trulson 2014-12-26 14:06:26 -07:00
parent 2d89ad036a
commit fa0074904b

View file

@ -736,6 +736,7 @@ _DtDbGetDataBaseEnv( void )
char *nwh_dir; char *nwh_dir;
char *temp_buf; char *temp_buf;
char *temp_s; char *temp_s;
int slen = 0;
nwh_dir = getenv ("HOME"); nwh_dir = getenv ("HOME");
/* /*
@ -745,9 +746,10 @@ _DtDbGetDataBaseEnv( void )
if (( temp_s = getenv ("DTDATABASESEARCHPATH"))) if (( temp_s = getenv ("DTDATABASESEARCHPATH")))
if ( *temp_s != 0 ) return XtNewString(temp_s); if ( *temp_s != 0 ) return XtNewString(temp_s);
temp_buf = slen = (2 * strlen(nwh_dir)) + strlen(DTDATABASESEARCHPATH_DEFAULT) + 1;
XtMalloc((2*strlen(nwh_dir)) + strlen(DTDATABASESEARCHPATH_DEFAULT) + 1); temp_buf = XtCalloc(1, slen);
sprintf (temp_buf, DTDATABASESEARCHPATH_DEFAULT, nwh_dir, nwh_dir); snprintf (temp_buf, slen - 1,
DTDATABASESEARCHPATH_DEFAULT, nwh_dir, nwh_dir);
return temp_buf; return temp_buf;
} }