various: You cannot use the destination of snprintf as one of the srcs, undefined
authorPeter Howkins <flibble@users.sf.net>
Sat, 14 Apr 2018 00:23:48 +0000 (01:23 +0100)
committerPeter Howkins <flibble@users.sf.net>
Sat, 14 Apr 2018 00:23:48 +0000 (01:23 +0100)
cde/lib/tt/mini_isam/isrename.c
cde/programs/dthelp/dthelpgen/helpgen.c
cde/programs/dthelp/dthelpprint/Initialize.c
cde/programs/dthelp/parser/pass1/helptag/help.c
cde/programs/dtlogin/auth.c

index 3691f26e455f26a0af7abc2e848451fc40e125dd..7f2b1be21327ad35fdbe6bedc8ae75e89975074e 100644 (file)
@@ -217,6 +217,7 @@ _rename_datfile(isfname, newname)
 {
     char       namebuf[MAXPATHLEN];
     char       newbuf[MAXPATHLEN];
+    char       newbuftemp[sizeof(newbuf)];
 
     snprintf(namebuf, sizeof(namebuf), "%s", isfname);
     snprintf(newbuf, sizeof(newbuf), "%s", isfname);
@@ -225,9 +226,12 @@ _rename_datfile(isfname, newname)
      * Replace the last element of the old path with newname.
      */
     _removelast(newbuf);
-    if (strcmp(newbuf, "/") != 0)
-        snprintf(newbuf, sizeof(newbuf),  "%s/", newbuf);
-    snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
+    if (strcmp(newbuf, "/") != 0) {
+        snprintf(newbuftemp, sizeof(newbuftemp),  "%s/", newbuf);
+        strcpy(newbuf, newbuftemp);
+    }
+    snprintf(newbuftemp, sizeof(newbuftemp), "%s%s", newbuf, newname);
+    strcpy(newbuf, newbuftemp);
 
     _makedat_isfname(namebuf);
     _makedat_isfname(newbuf);
@@ -242,6 +246,7 @@ _rename_indfile(isfname, newname)
 {
     char       namebuf[MAXPATHLEN];
     char       newbuf[MAXPATHLEN];
+    char       newbuftemp[MAXPATHLEN];
 
     snprintf(namebuf, sizeof(namebuf), "%s", isfname);
     snprintf(newbuf, sizeof(newbuf), "%s", isfname);
@@ -250,9 +255,12 @@ _rename_indfile(isfname, newname)
      * Replace the last element of the old path with newname.
      */
     _removelast(newbuf);
-    if (strcmp(newbuf, "/") != 0)
-        snprintf(newbuf, sizeof(newbuf), "%s/", newbuf);
-    snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
+    if (strcmp(newbuf, "/") != 0) {
+        snprintf(newbuftemp, sizeof(newbuftemp), "%s/", newbuf);
+        strcpy(newbuf, newbuftemp);
+    }
+    snprintf(newbuftemp, sizeof(newbuftemp), "%s%s", newbuf, newname);
+    strcpy(newbuf, newbuftemp);
 
     _makeind_isfname(namebuf);
     _makeind_isfname(newbuf);
@@ -267,6 +275,7 @@ _rename_varfile(isfname, newname)
 {
     char       namebuf[MAXPATHLEN];
     char       newbuf[MAXPATHLEN];
+    char       newbuftemp[MAXPATHLEN];
 
     snprintf(namebuf, sizeof(namebuf), "%s", isfname);
     snprintf(newbuf, sizeof(newbuf), "%s", isfname);
@@ -275,9 +284,12 @@ _rename_varfile(isfname, newname)
      * Replace the last element of the old path with newname.
      */
     _removelast(newbuf);
-    if (strcmp(newbuf, "/") != 0)
-        snprintf(newbuf, sizeof(newbuf), "%s/", newbuf);
-    snprintf(newbuf, sizeof(newbuf), "%s%s", newbuf, newname);
+    if (strcmp(newbuf, "/") != 0) {
+        snprintf(newbuftemp, sizeof(newbuftemp), "%s/", newbuf);
+        strcpy(newbuf, newbuftemp);
+    }
+    snprintf(newbuftemp, sizeof(newbuftemp), "%s%s", newbuf, newname);
+    strcpy(newbuf, newbuftemp);
 
     _makevar_isfname(namebuf);
     _makevar_isfname(newbuf);
index 05b74af684ef5a490d7245c007322498623b4052..2d194199b8b8056cf365fa2bf9a11ef29e573655 100644 (file)
@@ -389,6 +389,7 @@ CreateFamily (
     char       *bitmap = NULL;
     char        familyName [20];       /* FAMILY%d */
     char        bitmapName [MAXPATHLEN + 2];
+    char        bitmapNameTemp [sizeof(bitmapName)];
 
     XrmDatabase        db;
     char       *resType;
@@ -537,7 +538,8 @@ CreateFamily (
                      {
                        ptr++;
                        *ptr = '\0';
-                       snprintf(bitmapName, sizeof(bitmapName), "%s%s", bitmapName, bitmap);
+                       snprintf(bitmapNameTemp, sizeof(bitmapNameTemp), "%s%s", bitmapName, bitmap);
+                       strcpy(bitmapName, bitmapNameTemp);
                        bitmap = bitmapName;
                      }
                    else
@@ -948,11 +950,13 @@ main(
     int      doGen    = 0;
 
     char     tmpVolume  [MAXPATHLEN + 2];
+    char     tmpVolumeTemp[sizeof(tmpVolume)];
     char     tmpVolume2 [MAXPATHLEN + 2];
     char     tmpTopic   [MAXPATHLEN + 2];
     char     tmpHeader  [MAXPATHLEN + 2];
     char     headerName [MAXPATHLEN + 2];
     char     baseName   [MAXPATHLEN + 2];
+    char     baseNameTemp[sizeof(baseName)];
     char     tempName   [MAXPATHLEN + 2];
     char   **next;
     char    *charSet;
@@ -1057,7 +1061,8 @@ main(
                                myName, errno);
            exit (1);
          }
-        snprintf(baseName, sizeof(baseName), "%s/%s", baseName, App_args.dir);
+        snprintf(baseNameTemp, sizeof(baseNameTemp), "%s/%s", baseName, App_args.dir);
+        strcpy(baseName, baseNameTemp);
       }
     else
         snprintf(baseName, sizeof(baseName), "%s", App_args.dir);
@@ -1076,8 +1081,10 @@ main(
       }
 
     snprintf(tmpVolume, sizeof(tmpVolume), "%s", ptr);
-    if (tmpVolume[strlen (tmpVolume) - 1] != '/')
-        snprintf(tmpVolume, sizeof(tmpVolume), "%s", SlashString);
+    if (tmpVolume[strlen (tmpVolume) - 1] != '/') {
+        snprintf(tmpVolumeTemp, sizeof(tmpVolumeTemp), "%s%s", tmpVolume, SlashString);
+        strcpy(tmpVolume, tmpVolumeTemp);
+    }
 
     free (ptr);
 
@@ -1185,12 +1192,14 @@ main(
     /*
      * get temporary files for the volume and topic file.
      */
-    snprintf(tmpVolume, sizeof(tmpVolume), "%s%s", tmpVolume, App_args.file);
+    snprintf(tmpVolumeTemp, sizeof(tmpVolumeTemp), "%s%s", tmpVolume, App_args.file);
+    strcpy(tmpVolume, tmpVolumeTemp);
 
     (void) strcpy (tmpHeader, tmpVolume);
     (void) strcpy (tmpTopic, tmpVolume);
 
-    snprintf(tmpVolume, sizeof(tmpVolume), "%s%s", tmpVolume, Ext_Hv);
+    snprintf(tmpVolumeTemp, sizeof(tmpVolumeTemp), "%s%s", tmpVolume, Ext_Hv);
+    strcpy(tmpVolume, tmpVolumeTemp);
     (void) strcat (tmpHeader, "00.ht");
     (void) strcat (tmpTopic , "01.ht");
 
index 381f16a583d8a4740a5f4f008cf129e05583ea37..c18d5527b13f83bf6de55abd433de1ffb0f973f4 100644 (file)
@@ -796,7 +796,9 @@ static float dphm = 300.*2540.;
    int  (*stricmp)(const char *,const char *);
    char *name;
    char name_prefix[RSRCSPECLEN];
+   char name_prefix_temp[sizeof(name_prefix)];
    char class_prefix[RSRCSPECLEN];
+   char class_prefix_temp[sizeof(class_prefix)];
    char resource_name[RSRCSPECLEN];
    char resource_class[RSRCSPECLEN];
    char *str_type[20];
@@ -825,8 +827,10 @@ static float dphm = 300.*2540.;
    else name = EMPTY_STR;
    if (name[0] != EOS)
    {
-      snprintf(name_prefix, sizeof(name_prefix), "%s%s%s", name_prefix, DOT_STR, name);    /* e.g. dthelpprint.printer.<name> */
-      snprintf(class_prefix, sizeof(class_prefix), "%s%s%s", class_prefix, DOT_STR, name); /* e.g. Dthelpprint.Printer.<name> */
+      snprintf(name_prefix_temp, sizeof(name_prefix_temp), "%s%s%s", name_prefix, DOT_STR, name);    /* e.g. dthelpprint.printer.<name> */
+      strcpy(name_prefix, name_prefix_temp);
+      snprintf(class_prefix_temp, sizeof(class_prefix_temp), "%s%s%s", class_prefix, DOT_STR, name); /* e.g. Dthelpprint.Printer.<name> */
+      strcpy(class_prefix, class_prefix_temp);
    }
    
    /**************************/
index 9c6c235c63808841eba8e1d9449ca9f2c97b0c19..2e69b0c96a9ee2710d00cf83e9fe45381e2eef16 100644 (file)
@@ -1501,6 +1501,7 @@ static const char *isoString = "ISO-8859-1";
 _DtXlateDb  myDb = NULL;
 char        myPlatform[_DtPLATFORM_MAX_LEN+1];
 char        myLocale[256]; /* arbitrarily large */
+char        myLocaleTemp[sizeof(myLocale)]; /* non-arbitrarily the same */
 char       *locale;
 char       *lang;
 char       *charset;
@@ -1511,7 +1512,8 @@ int         isStd;
 snprintf(myLocale, sizeof(myLocale), "%s", pLang);
 if (*pCharset)
     {
-    snprintf(myLocale, sizeof(myLocale), "%s.%s", myLocale, pCharset);
+    snprintf(myLocaleTemp, sizeof(myLocaleTemp), "%s.%s", myLocale, pCharset);
+    strcpy(myLocale, myLocaleTemp);
     }
 
 if ((_DtLcxOpenAllDbs(&myDb) != 0) ||
index 4b22081be016e4905ddb3fb417a537ca227e5386..6802a28bde5614c444018d53f533f998263b4c8a 100644 (file)
@@ -1140,6 +1140,7 @@ SetUserAuthorization (struct display *d, struct verify_info *verify)
 {
     FILE       *old, *new;
     char       home_name[1024], backup_name[1024], new_name[1024];
+    char       home_name_temp[sizeof(home_name)];
     char       *name;
     char       *home;
     char       *envname = 0;
@@ -1159,9 +1160,12 @@ SetUserAuthorization (struct display *d, struct verify_info *verify)
        lockStatus = LOCK_ERROR;
        if (home) {
            snprintf(home_name, sizeof(home_name), "%s", home);
-           if (home[strlen(home) - 1] != '/')
-               snprintf(home_name, sizeof(home_name), "%s/", home_name);
-           snprintf(home_name, sizeof(home_name), "%s.Xauthority", home_name);
+           if (home[strlen(home) - 1] != '/') {
+               snprintf(home_name_temp, sizeof(home_name_temp), "%s/", home_name);
+               strcpy(home_name, home_name_temp);
+           }
+           snprintf(home_name_temp, sizeof(home_name_temp), "%s.Xauthority", home_name);
+        strcpy(home_name, home_name_temp);
            Debug ("XauLockAuth %s\n", home_name);
            lockStatus = XauLockAuth (home_name, 1, 2, 10);
            Debug ("Lock is %d\n", lockStatus);
@@ -1319,6 +1323,7 @@ RemoveUserAuthorization (struct display *d, struct verify_info *verify)
     char    *home;
     Xauth   **auths, *entry;
     char    name[1024], new_name[1024];
+    char    name_temp[sizeof(name)];
     int            lockStatus;
     FILE    *old, *new;
     struct stat        statb;
@@ -1332,9 +1337,12 @@ RemoveUserAuthorization (struct display *d, struct verify_info *verify)
        return;
     Debug ("RemoveUserAuthorization\n");
     snprintf(name, sizeof(name), "%s", home);
-    if (home[strlen(home) - 1] != '/')
-        snprintf(name, sizeof(name), "%s/", name);
-    snprintf(name, sizeof(name), "%s.Xauthority", name);
+    if (home[strlen(home) - 1] != '/') {
+        snprintf(name_temp, sizeof(name_temp), "%s/", name);
+        strcpy(name, name_temp);
+    }
+    snprintf(name_temp, sizeof(name_temp), "%s.Xauthority", name);
+    strcpy(name, name_temp);
     Debug ("XauLockAuth %s\n", name);
     lockStatus = XauLockAuth (name, 1, 2, 10);
     Debug ("Lock is %d\n", lockStatus);