From 0385de10a1cde2e520dc38fdb9ce1707e36afe1d Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Mon, 24 Feb 2003 16:37:03 +0000 Subject: [PATCH] salvager-create-larger-buffer-for-inodes-tmpfile-and-avoid-overrun-20030224 FIXES 1318 pointed out by Hartmut Reuter --- src/vol/vol-salvage.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vol/vol-salvage.c b/src/vol/vol-salvage.c index 136a6dd458..e659ec1cce 100644 --- a/src/vol/vol-salvage.c +++ b/src/vol/vol-salvage.c @@ -1136,7 +1136,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; @@ -1202,9 +1202,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);