From: Derrick Brashear Date: Mon, 24 Feb 2003 16:37:53 +0000 (+0000) Subject: STABLE12-salvager-create-larger-buffer-for-inodes-tmpfile-and-avoid-overrun-20030224 X-Git-Tag: openafs-stable-1_2_9~52 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=2d6897746a7d79a4aaeb02cb798178f9e745a6c1;p=packages%2Fo%2Fopenafs.git STABLE12-salvager-create-larger-buffer-for-inodes-tmpfile-and-avoid-overrun-20030224 FIXES 1318 pointed out by Hartmut Reuter (cherry picked from commit 0385de10a1cde2e520dc38fdb9ce1707e36afe1d) --- diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 7027aa695..b21032f2d 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -1114,7 +1114,7 @@ char *wpath, *pbuffer; void SalvageFileSys1(struct DiskPartition *partP, VolumeId singleVolumeNumber) { char *name, *tdir; - char inodeListPath[50]; + char inodeListPath[256]; static char tmpDevName[100]; static char wpath[100]; struct VolumeSummary *vsp, *esp; @@ -1180,9 +1180,9 @@ void SalvageFileSys1(struct DiskPartition *partP, VolumeId singleVolumeNumber) tdir = (tmpdir ? tmpdir : fileSysPath); #ifdef AFS_NT40_ENV (void) _putenv("TMP="); /* If "TMP" is set, then that overrides tdir. */ - (void) strcpy(inodeListPath, _tempnam(tdir, "salvage.inodes.")); + (void) strncpy(inodeListPath, _tempnam(tdir, "salvage.inodes."), 255); #else - sprintf(inodeListPath, "%s/salvage.inodes.%s.%d", tdir, name, getpid()); + snprintf(inodeListPath, 255, "%s/salvage.inodes.%s.%d", tdir, name, getpid()); #endif if (GetInodeSummary(inodeListPath, singleVolumeNumber) < 0) { unlink(inodeListPath);