dtsession: fix VU#497553
authorJon Trulson <jon@radscan.com>
Sun, 27 May 2012 01:29:50 +0000 (19:29 -0600)
committerJon Trulson <jon@radscan.com>
Sun, 27 May 2012 01:29:50 +0000 (19:29 -0600)
cde/programs/dtsession/SmGlobals.c
cde/programs/dtsession/SmUI.c
cde/programs/dtsession/SmXdef.c

index bbad78470b303991c8971f73f077d27a87ccc15b..2a809ee62664bfc42c8fcb7b1952ff8a1c8ea7f6 100644 (file)
@@ -2215,6 +2215,7 @@ InitializeSpecificSession (
 {
        char            *session_dir = (char *) XtMalloc(MAXPATHLEN);
        char            *alt_dir = (char *) XtMalloc(MAXPATHLEN);
+        int             len;
        struct stat     buf;
 
        if (!InternSessionDir (session_option, disp))
@@ -2283,6 +2284,16 @@ InitializeSpecificSession (
 
                        if ((home = getenv ("HOME")) == 0)
                                home = "";
+
+                        /* JET - VU#497553 */
+                       len = strlen(home) + 
+                         strlen(DtPERSONAL_CONFIG_DIRECTORY) +
+                         strlen(DtSM_SESSION_DIRECTORY) +
+                         strlen(SM_HOME_DIRECTORY);
+
+                       if (len > MAXPATHLEN)
+                         alt_dir = XtRealloc(alt_dir, len + 1);
+
                        (void) sprintf (alt_dir, "%s/%s/%s/%s",
                                        home,
                                        DtPERSONAL_CONFIG_DIRECTORY,
@@ -2325,6 +2336,16 @@ InitializeSpecificSession (
                                 */
                                if ((home = getenv ("HOME")) == 0)
                                        home = "";
+
+                                /* JET - VU#497553 */
+                               len = strlen(home) + 
+                                 strlen(DtPERSONAL_CONFIG_DIRECTORY) +
+                                 strlen(DtSM_SESSION_DIRECTORY) +
+                                 strlen(SM_HOME_DIRECTORY);
+
+                               if (len > MAXPATHLEN)
+                                 alt_dir = XtRealloc(alt_dir, len + 1);
+
                                (void) sprintf (alt_dir, "%s/%s/%s/%s",
                                                home,
                                                DtPERSONAL_CONFIG_DIRECTORY,
index 167ea86b296ecdd7109fc8b1e88a894fef6baf3e..243996d01a22a36b3694b49028db4b9059c8dc57 100644 (file)
@@ -2116,6 +2116,7 @@ PostXSMPFailureDialog (
        Dimension       width, height;
        Position        x, y;
        XEvent          next;
+        int             len;
 
        pch1 = strdup ((char *) GETMESSAGE(40, 1, 
                "A session cannot be started because of the\nfollowing error:"));
@@ -2171,13 +2172,26 @@ PostXSMPFailureDialog (
 
        error_file = XtMalloc(MAXPATHLEN+1);
        strcpy (error_file, "");
-       if (check_errorlog) {
-               char            *home;
 
-               if (home = getenv ("HOME"))
-                       sprintf (error_file, "%s/%s/%s", home, DtPERSONAL_CONFIG_DIRECTORY,
-                                        DtERRORLOG_FILE);
-       }
+        /* JET - VU#497553 */
+       if (check_errorlog) 
+         {
+           char                *home;
+
+           if (home = getenv ("HOME"))
+             {
+               len = strlen(home) +
+                 strlen(DtPERSONAL_CONFIG_DIRECTORY) +
+                 strlen(DtERRORLOG_FILE);
+
+               if (len > MAXPATHLEN)
+                 error_file = XtRealloc(error_file, len + 1);
+
+               sprintf (error_file, "%s/%s/%s", home, 
+                        DtPERSONAL_CONFIG_DIRECTORY,
+                        DtERRORLOG_FILE);
+             }
+         }
 
        pch5 = XtMalloc (strlen (pch1) + strlen (pch2) + strlen (pch3) + strlen (pch4) + 
                                strlen (error_file) + 15);
index 094992058acd8618ef996920f73f414dab687821..9fbaddb29f2cd3b6d855ee370ff87404813aba66 100644 (file)
@@ -91,13 +91,17 @@ void
 SmXdefMerge(Display *display)
 {
   char *xdefaults;
+  char *home;
 
  /*
   * Load .Xdefaults
   */
-  if( (xdefaults = (char *)malloc(strlen(getenv("HOME"))+12)) != NULL)  
+  if ((home = getenv("HOME")) == NULL)
+    home = "";
+
+  if( (xdefaults = (char *)malloc(strlen(home)+12)) != NULL)  
   {
-    sprintf(xdefaults,"%s/%s",getenv("HOME"),".Xdefaults");
+    sprintf(xdefaults,"%s/%s",home,".Xdefaults");
     if(access(xdefaults,R_OK) == 0)
     {
       FILE *fp;