diff -urN xv-6.0.1-orig/src/xv.c xv-6.0.1/src/xv.c
--- xv-6.0.1-orig/src/xv.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xv.c	2024-09-23 15:07:06 +0900
@@ -3508,7 +3508,7 @@
     strcat(namez,".Z");
 
     if (rename(name, namez) < 0) {
-      sprintf(buf, "Error renaming '%s' to '%s':  %s",
+      snprintf(buf, sizeof(buf), "Error renaming '%s' to '%s':  %s",
 	      name, namez, ERRSTR(errno));
       ErrPopUp(buf, "\nBummer!");
       return 0;
@@ -3584,7 +3584,7 @@
 
   if (strlen(namez)) {
     if (rename(namez, name) < 0) {
-      sprintf(buf, "Error renaming '%s' to '%s':  %s",
+      snprintf(buf, sizeof(buf), "Error renaming '%s' to '%s':  %s",
 	      namez, name, ERRSTR(errno));
       ErrPopUp(buf, "\nBummer!");
     }
@@ -3809,11 +3809,11 @@
   strcat(fullcmd, tmpname);
 
   /* execute the command */
-  sprintf(str, "Doing command: '%s'", fullcmd);
+  snprintf(str, sizeof(str), "Doing command: '%s'", fullcmd);
   OpenAlert(str);
   i = system(fullcmd);
   if (i) {
-    sprintf(str, "Unable to complete command:\n  %s\n\n  exit status: %d",
+    snprintf(str, sizeof(str), "Unable to complete command:\n  %s\n\n  exit status: %d",
 	    fullcmd, i);
     CloseAlert();
     ErrPopUp(str, "\nThat Sucks!");
@@ -4190,20 +4190,20 @@
   char winname[NAME_MAX+sizeof("xv : ")+sizeof(VERSTR)+sizeof(" <unregistered>")+1], iconname[NAME_MAX+1];
 
   if (winTitle) {
-    strcpy(winname, winTitle);
-    strcpy(iconname, winTitle);
+    snprintf(winname, sizeof(winname), "%s", winTitle);
+    snprintf(iconname, sizeof(iconname), "%s", winTitle);
   }
   else if (name[0] == '\0') {
-    sprintf(winname, "xv %s",VERSTR);
-    sprintf(iconname,"xv");
+    snprintf(winname, sizeof(winname), "xv %s",VERSTR);
+    snprintf(iconname, sizeof(iconname), "xv");
   }
   else {
-    sprintf(winname, "xv %s: %.*s", VERSTR, NAME_MAX, name);
-    sprintf(iconname, "%.*s", NAME_MAX, name);
+    snprintf(winname, sizeof(winname), "xv %s: %.*s", VERSTR, NAME_MAX, name);
+    snprintf(iconname, sizeof(iconname), "%.*s", NAME_MAX, name);
   }
 
 #ifndef REGSTR
-  strcat(winname, " <unregistered>");
+  snprintf(winname+strlen(winname), sizeof(winname)-strlen(winname), " <unregistered>");
 #endif
 
   if (mainW) {
@@ -4460,7 +4460,7 @@
   delnum = nList.selected;
   if (delnum < 0 || delnum >= numnames) return 0;
 
-  sprintf(str, "Delete '%s'?\n\n%s%s", namelist[delnum],
+  snprintf(str, sizeof(str), "Delete '%s'?\n\n%s%s", namelist[delnum],
 	  "'List Entry' deletes selection from list.\n",
 	  "'Disk File' deletes file associated with selection.");
 
@@ -4479,7 +4479,7 @@
 
     i = unlink(name);
     if (i) {
-      sprintf(str,"Can't delete file '%s'\n\n  %s.", name, ERRSTR(errno));
+      snprintf(str, sizeof(str), "Can't delete file '%s'\n\n  %s.", name, ERRSTR(errno));
       ErrPopUp(str, "\nPity");
       if (name != namelist[delnum]) free(name);
       return 0;
diff -urN xv-6.0.1-orig/src/xvcut.c xv-6.0.1/src/xvcut.c
--- xv-6.0.1-orig/src/xvcut.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xvcut.c	2024-09-23 15:07:06 +0900
@@ -797,7 +797,7 @@
   fp = fopen(clipfname, "r");
   if (!fp) {
     unlink(clipfname);
-    sprintf(str, "Can't read clipboard file '%s'\n\n  %s.",
+    snprintf(str, sizeof(str), "Can't read clipboard file '%s'\n\n  %s.",
 	    clipfname, ERRSTR(errno));
     ErrPopUp(str,"\nBletch!");
     return (byte *) NULL;
@@ -807,7 +807,7 @@
   if (fread((char *) lbuf, (size_t) 1, (size_t) 4, fp) != 4) {
     fclose(fp);
     unlink(clipfname);
-    sprintf(str, "Error occurred while reading clipboard file.\n\n  %s.",
+    snprintf(str, sizeof(str), "Error occurred while reading clipboard file.\n\n  %s.",
 	    ERRSTR(errno));
     ErrPopUp(str,"\nGlork!");
     return (byte *) NULL;
@@ -835,7 +835,7 @@
     fclose(fp);
     free(data);
     unlink(clipfname);
-    sprintf(str, "Error occurred while reading clipboard file.\n\n  %s.",
+    snprintf(str, sizeof(str), "Error occurred while reading clipboard file.\n\n  %s.",
 	    ERRSTR(errno));
     ErrPopUp(str,"\nNertz!");
     return (byte *) NULL;
@@ -899,7 +899,7 @@
   fp = fopen(clipfname, "w");
   if (!fp) {
     unlink(clipfname);
-    sprintf(str, "Can't write clipboard file '%s'\n\n  %s.",
+    snprintf(str, sizeof(str), "Can't write clipboard file '%s'\n\n  %s.",
 	    clipfname, ERRSTR(errno));
     ErrPopUp(str,"\nBletch!");
     return;
@@ -908,7 +908,7 @@
   if (fwrite((char *) cimg, (size_t) 1, (size_t) len, fp) != len) {
     fclose(fp);
     unlink(clipfname);
-    sprintf(str, "Error occurred while writing to clipboard file.\n\n  %s.",
+    snprintf(str, sizeof(str), "Error occurred while writing to clipboard file.\n\n  %s.",
 	    ERRSTR(errno));
     ErrPopUp(str,"\nGlork!");
     return;
diff -urN xv-6.0.1-orig/src/xvevent.c xv-6.0.1/src/xvevent.c
--- xv-6.0.1-orig/src/xvevent.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xvevent.c	2024-09-23 15:07:06 +0900
@@ -1282,6 +1282,7 @@
   SetDirSaveMode(F_FORMAT, F_PS);
   SetDirSaveMode(F_COLORS, i);
 
+  if (strlen(printCmd)+3 > sizeof(str)) FatalError("print command buffer overflow");
   if (printCmd[0] != '|' && printCmd[0] != '!')
     sprintf(str, "| %s", printCmd);
   else strcpy(str, printCmd);
diff -urN xv-6.0.1-orig/src/xvgif.c xv-6.0.1/src/xvgif.c
--- xv-6.0.1-orig/src/xvgif.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xvgif.c	2024-09-23 15:07:06 +0900
@@ -441,7 +441,7 @@
 	    unlink(pinfo->pagebname);  /* no errors during testing */
 	  }
 	}
-	sprintf(tmpname, "%s%d", pinfo->pagebname, pinfo->numpages);
+	snprintf(tmpname, sizeof(tmpname), "%s%d", pinfo->pagebname, pinfo->numpages);
 	fp = xv_fopen(tmpname, "w");
 	if (!fp) {
 	  ErrPopUp("LoadGIF: Unable to open temp file", "\nDang!");
@@ -505,7 +505,7 @@
     /* write the last page temp file */
     int numpages = pinfo->numpages;
     char *comment = pinfo->comment;
-    sprintf(tmpname, "%s%d", pinfo->pagebname, pinfo->numpages);
+    snprintf(tmpname, sizeof(tmpname), "%s%d", pinfo->pagebname, pinfo->numpages);
     fp = xv_fopen(tmpname, "w");
     if (!fp) {
       ErrPopUp("LoadGIF: Unable to open temp file", "\nDang!");
@@ -522,7 +522,7 @@
     pinfo->pic = (byte *) NULL;
 
     /* load the first page temp file */
-    sprintf(tmpname, "%s%d", pinfo->pagebname, 1);
+    snprintf(tmpname, sizeof(tmpname), "%s%d", pinfo->pagebname, 1);
     i = LoadGIF(tmpname, pinfo);
     pinfo->numpages = numpages;
     pinfo->comment = comment;
diff -urN xv-6.0.1-orig/src/xvimage.c xv-6.0.1/src/xvimage.c
--- xv-6.0.1-orig/src/xvimage.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xvimage.c	2024-09-23 15:07:06 +0900
@@ -2974,7 +2974,7 @@
 
 
 #ifndef VMS
-  sprintf(fname, "%s/xvXXXXXX", tmpdir);
+  snprintf(fname, sizeof(fname), "%s/xvXXXXXX", tmpdir);
 #else
   strcpy(fname, "Sys$Disk:[]xvuXXXXXX");
 #endif
@@ -3272,7 +3272,7 @@
       ftype = ReadFileType(uncompname);
     }
     else {
-      sprintf(errstr, "Error:  Couldn't uncompress file '%s'", name);
+      snprintf(errstr, sizeof(errstr), "Error:  Couldn't uncompress file '%s'", name);
       ErrPopUp(errstr, "\nOk");
       return 0;
     }
@@ -3280,12 +3280,12 @@
 
 
   if (ftype == RFT_ERROR) {
-    sprintf(errstr, "Couldn't open file '%s'\n\n  %s.", name, ERRSTR(errno));
+    snprintf(errstr, sizeof(errstr), "Couldn't open file '%s'\n\n  %s.", name, ERRSTR(errno));
     ErrPopUp(errstr, "\nOk");
     return 0;
   }
   else if (ftype == RFT_UNKNOWN) {
-    sprintf(errstr, "Error:  File '%s' not in a recognized format.", name);
+    snprintf(errstr, sizeof(errstr), "Error:  File '%s' not in a recognized format.", name);
     ErrPopUp(errstr, "\nOk");
     return 0;
   }
@@ -3298,7 +3298,7 @@
 	if (pinfo->pic)     free(pinfo->pic);
 	if (pinfo->comment) free(pinfo->comment);
       }
-      sprintf(errstr, "Couldn't load file '%s'.", name);
+      snprintf(errstr, sizeof(errstr), "Couldn't load file '%s'.", name);
       ErrPopUp(errstr, "\nOk");
       return 0;
     }
diff -urN xv-6.0.1-orig/src/xvps.c xv-6.0.1/src/xvps.c
--- xv-6.0.1-orig/src/xvps.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xvps.c	2024-09-23 15:07:06 +0900
@@ -1568,10 +1568,10 @@
   /* build 'gscmd' string */
 
 #ifndef VMS  /* VMS needs quotes around mixed case command lines */
-  sprintf(gscmd, "%s -sDEVICE=%s -r%d -q -dSAFER -dNOPAUSE -sOutputFile=%s%%d ",
+  snprintf(gscmd, sizeof(gscmd), "%s -sDEVICE=%s -r%d -q -dSAFER -dNOPAUSE -sOutputFile=%s%%d ",
 	  GS_PATH, gsDev, res, tmpname);
 #else
-  sprintf(gscmd,
+  snprintf(gscmd, sizeof(gscmd),
 	  "%s \"-sDEVICE=%s\" -r%d -q \"-dNOPAUSE\" \"-sOutputFile=%s%%d\" ",
 	  GS_PATH, gsDev, res, tmpname);
 #endif
@@ -1583,21 +1583,21 @@
 #  else
      sprintf(tmp, "\"-I%s\" ", GS_LIB);
 #  endif
-   strcat(gscmd, tmp);
+   snprintf(gscmd+strlen(gscmd), sizeof(gscmd)-strlen(gscmd), "%s", tmp);
 #endif
 
 
    /* prevent some potential naughtiness... */
 #ifndef VMS
-   strcat(gscmd, "-dSAFER ");
+   snprintf(gscmd+strlen(gscmd), sizeof(gscmd)-strlen(gscmd), "%s", "-dSAFER ");
 #else
-   strcat(gscmd, "\"-dSAFER\" ");
+   snprintf(gscmd+strlen(gscmd), sizeof(gscmd)-strlen(gscmd), "%s", "\"-dSAFER\" ");
 #endif
 
 
   if (gsGeomStr) {
     sprintf(tmp, "-g%s ", gsGeomStr);
-    strcat(gscmd, tmp);
+    snprintf(gscmd+strlen(gscmd), sizeof(gscmd)-strlen(gscmd), "%s", tmp);
   }
 
 
@@ -1665,7 +1665,7 @@
      as it won't be needed. */
 
 
-  sprintf(tmp, "%s%d", tmpname, 1);
+  snprintf(tmp, sizeof(tmp), "%s%d", tmpname, 1);
   filetype = ReadFileType(tmp);
 
   if (filetype == RFT_ERROR || filetype == RFT_UNKNOWN ||
@@ -1691,7 +1691,7 @@
   /* SUCCESS! */
 
   if (nump>1) {
-    strcpy(pinfo->pagebname, tmpname);
+    snprintf(pinfo->pagebname, sizeof(pinfo->pagebname), "%s", tmpname);
   }
   pinfo->numpages = nump;
 
diff -urN xv-6.0.1-orig/src/xvtext.c xv-6.0.1/src/xvtext.c
--- xv-6.0.1-orig/src/xvtext.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xvtext.c	2024-09-23 15:07:06 +0900
@@ -2259,7 +2259,7 @@
 	    else
 		y = 5*dpiMult + LINEHIGH * 7 + SPACING * 3;
 
-	    sprintf(buf, "Designation for G%d:", i + 1);
+	    snprintf(buf, sizeof(buf), "Designation for G%d:", i + 1);
 	    DrawString(cs->win, x, y + ASCENT, buf);
 
 	    LSCreate(&cs->ls[i], cs->win, x + 15*dpiMult, y + LINEHIGH,
@@ -2565,7 +2565,7 @@
 	else
 	    y = 5*dpiMult + LINEHIGH * 7 + SPACING * 3;
 
-	sprintf(buf, "Designation for G%d:", i);
+	snprintf(buf, sizeof(buf), "Designation for G%d:", i);
 	DrawString(cs->win, x, y + ASCENT, buf);
     }
 
diff -urN xv-6.0.1-orig/src/xvtiff.c xv-6.0.1/src/xvtiff.c
--- xv-6.0.1-orig/src/xvtiff.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xvtiff.c	2024-09-23 15:07:06 +0900
@@ -504,11 +504,11 @@
   char *cp = buf;
 
   if (module != NULL) {
-    sprintf(cp, "%s: ", module);
+    snprintf(cp, sizeof(buf)-1-(cp-buf), "%s: ", module);
     cp = (char *) index(cp, '\0');
   }
 
-  vsprintf(cp, fmt, ap);
+  vsnprintf(cp, sizeof(buf)-1-(cp-buf), fmt, ap);
   strcat(cp, ".");
 
   SetISTR(ISTR_WARNING, "%s", buf);
@@ -524,12 +524,12 @@
   char *cp = buf;
 
   if (module != NULL) {
-    sprintf(cp, "%s: ", module);
+    snprintf(cp, sizeof(buf)-1-(cp-buf), "%s: ", module);
     cp = (char *) index(cp, '\0');
   }
-  strcpy(cp, "Warning, ");
+  snprintf(cp, sizeof(buf)-1-(cp-buf), "%s", "Warning, ");
   cp = (char *) index(cp, '\0');
-  vsprintf(cp, fmt, ap);
+  vsnprintf(cp, sizeof(buf)-1-(cp-buf), fmt, ap);
   strcat(cp, ".");
 
   SetISTR(ISTR_WARNING, "%s", buf);
diff -urN xv-6.0.1-orig/src/xvvd.c xv-6.0.1/src/xvvd.c
--- xv-6.0.1-orig/src/xvvd.c	2024-09-02 02:56:28 +0900
+++ xv-6.0.1/src/xvvd.c	2024-09-23 15:07:06 +0900
@@ -122,7 +122,7 @@
     if (Mkvdir(dir) == VD_ERR)
 	return -1;
 
-    strcpy(buf, dir);
+    snprintf(buf, sizeof(buf), "%s", dir);
     Dirtovd(buf);
 
     return (chdir(buf));
@@ -156,7 +156,7 @@
 	if (!strncmp(dir, vdtable[i], strlen(vdtable[i]))) {
 	    char tmp[MAXPATHLEN+1];
 
-	    sprintf(tmp, "%s%s", vdroot, dir);
+	    snprintf(tmp, sizeof(tmp), "%s%s", vdroot, dir);
 	    strcpy(dir, tmp);
 	    Dirtovd(dir);
 	}
@@ -175,9 +175,9 @@
     char tmp[MAXPATHLEN+1];
 
     for (i = vdcount-1; i >= 0; i--) {
-	sprintf(tmp, "%s%s", vdroot, vdtable[i]);
+	snprintf(tmp, sizeof(tmp), "%s%s", vdroot, vdtable[i]);
 	if(!strncmp(vd, tmp, strlen(tmp))) {
-	    strcpy(tmp, vd+strlen(vdroot));
+	    snprintf(tmp, sizeof(tmp), "%s", vd+strlen(vdroot));
 	    strcpy(vd, tmp);
 	    Vdtodir(vd);
 	}
@@ -190,7 +190,7 @@
 
     Dirtovd(dir);
 
-    strcpy(tmp, dir+strlen(vdroot));
+    snprintf(tmp, sizeof(tmp), "%s", dir+strlen(vdroot));
 
     if (Isarchive(tmp))
 	strcpy(dir, tmp);
@@ -290,7 +290,7 @@
     mask = block_signal(SIGHUP);
     /* block_signal(SIGCHLD); */ /* breaks calls to system() */
 
-    strcpy(dir1, dir);
+    snprintf(dir1, sizeof(dir1), "%s", dir);
     vd_optimize_path(dir1);
 
     if ((rv = vd_Mkvdir(dir1)) != VD_ERR)
@@ -329,7 +329,7 @@
     struct stat st;
     FILE *pfp;
 
-    strcpy(dir1, dir);
+    snprintf(dir1, sizeof(dir1), "%s", dir);
     Dirtovd(dir1);
     strcpy(dir2, dir1);
 
@@ -374,7 +374,7 @@
 		Warning();
 		goto VD_MKVDIR_ERR;
 	    }
-	    sprintf(buf, ext_command[ftype], QuoteFileName(quoted_dir, dir1, XV_MAXQUOTEDPATHLEN));
+	    snprintf(buf, sizeof(buf), ext_command[ftype], QuoteFileName(quoted_dir, dir1, XV_MAXQUOTEDPATHLEN));
 
 	    WaitCursor();
 
@@ -429,7 +429,7 @@
       return;
     }
 
-    sprintf(tmp, "%s%s", vdroot, dir);
+    snprintf(tmp, sizeof(tmp), "%s%s", vdroot, dir);
     if (vd_recursive_mkdir(tmp)) {
       SetISTR(ISTR_INFO, "Failed to make virtual directory.");
       Warning();
@@ -452,7 +452,7 @@
     int rv;
     char buf[MAXPATHLEN+1];
 
-    strcpy(buf, dir);
+    snprintf(buf, sizeof(buf), "%s", dir);
     vd_optimize_path(buf);
 
     rv = vd_Rmvdir(buf);
@@ -467,7 +467,7 @@
 
     for(i = 0; i < vdcount; i++)
 	if (!strncmp(dir, vdtable[i], strlen(dir))) {
-	    sprintf(tmp, "%s%s", vdroot, vdtable[i]);
+	    snprintf(tmp, sizeof(tmp), "%s%s", vdroot, vdtable[i]);
 	    if (vd_Rmvdir(tmp))
 		return 1;
 	    if (vd_recursive_rmdir(tmp))
@@ -489,10 +489,10 @@
 /*
     char sbuf[MAXPATHLEN+1], dbuf[MAXPATHLEN+1];
 
-    strcpy(sbuf, src);
+    snprintf(sbuf, sizeof(sbuf), "%s", src);
     vd_optimize_path(sbuf);
 
-    strcpy(dbuf, dst);
+    snprintf(dbuf, sizeof(dbuf), "%s", dst);
     vd_optimize_path(dbuf);
 
     return (vd_Movevdir(sbuf, dbuf));
@@ -583,7 +583,7 @@
     int len;
     struct stat st;
 
-    strcpy(buf, dir);
+    snprintf(buf, sizeof(buf), "%s", dir);
 
     len = strlen(buf);
     if (len > 0 && buf[len - 1] == '/') {
@@ -614,7 +614,7 @@
     DIR *dp;
     struct dirent *di;
 
-    strcpy(buf, dir);
+    snprintf(buf, sizeof(buf), "%s", dir);
 
     if (buf[strlen(buf) - 1] == '/')
 	buf[strlen(buf) - 1] = '\0';
@@ -628,7 +628,7 @@
 	if (!strcmp(di->d_name, ".") || !strcmp(di->d_name, ".."))
 	    continue;
 
-	sprintf(buf2, "%s/%s", dir, di->d_name);
+	snprintf(buf2, sizeof(buf2), "%s/%s", dir, di->d_name);
 
 	stat(buf2, &st);
 	if (S_ISDIR(st.st_mode)) {
@@ -678,8 +678,8 @@
     char tmp1[MAXPATHLEN+1], tmp2[MAXPATHLEN+1];
     int archive1, archive2;
 
-    strcpy(tmp1, path);
-    strcpy(tmp2, path);
+    snprintf(tmp1, sizeof(tmp1), "%s", path);
+    snprintf(tmp2, sizeof(tmp2), "%s", path);
 
     vd_optimize_path(tmp1);
     Dirtovd(tmp2);
@@ -732,7 +732,7 @@
     if (*path != '/') {
 	char tmp[MAXPATHLEN+1];
 
-	strcpy(tmp, path);
+	snprintf(tmp, sizeof(tmp), "%s", path);
 	xv_getwd(path, MAXPATHLEN+1);
 	strcat(path, "/");
 	strcat(path, tmp);
@@ -926,11 +926,10 @@
     if (strlen(name) >= (size_t) 2            &&
 	strcmp(name + strlen(name)-2,".Z")!=0 &&
 	strcmp(name + strlen(name)-2,".z")!=0) {
-	strcpy(namez, name);
-	strcat(namez,".Z");
+	snprintf(namez, sizeof(namez), "%s.Z", name);
 
 	if (rename(name, namez) < 0) {
-	    sprintf(buf, "Error renaming '%s' to '%s':  %s",
+	    snprintf(buf, sizeof(buf), "Error renaming '%s' to '%s':  %s",
 		    name, namez, ERRSTR(errno));
 	    ErrPopUp(buf, "\nBummer!");
 	    return 0;
@@ -940,7 +939,7 @@
     }
 #endif   /* not GUNZIP */
 
-    sprintf(uncompname, "%s/xvuXXXXXX", tmpdir);
+    snprintf(uncompname, sizeof(uncompname), "%s/xvuXXXXXX", tmpdir);
 #ifdef USE_MKSTEMP
     tmpfd = mkstemp(uncompname);
 #else
@@ -955,14 +954,14 @@
     buf[0] = '\0';
     QuoteFileName(quoted_name, fname, XV_MAXQUOTEDPATHLEN);
     if (filetype == RFT_COMPRESS)
-      sprintf(buf,"%s -c %s", UNCOMPRESS, quoted_name);
+      snprintf(buf, sizeof(buf), "%s -c %s", UNCOMPRESS, quoted_name);
 #ifdef BUNZIP2
     else if (filetype == RFT_BZIP2)
-      sprintf(buf,"%s -c %s", BUNZIP2, quoted_name);
+      snprintf(buf, sizeof(buf), "%s -c %s", BUNZIP2, quoted_name);
 #endif
 #ifdef XZ
     else if (filetype == RFT_XZ)
-      sprintf(buf,"%s -c %s", XZ, quoted_name);
+      snprintf(buf, sizeof(buf), "%s -c %s", XZ, quoted_name);
 #endif
     else
       return 0;
@@ -1017,7 +1016,7 @@
 
     if (strlen(namez)) {
 	if (rename(namez, name) < 0) {
-	    sprintf(buf, "Error renaming '%s' to '%s':  %s",
+	    snprintf(buf, sizeof(buf), "Error renaming '%s' to '%s':  %s",
 		    namez, name, ERRSTR(errno));
 	    ErrPopUp(buf, "\nBummer!");
 	}
