mtree should use getcwd() instead of getwd(). getcwd() is safer,

because it includes checks for the length of the buffer it uses.

Reviewed by:	phk, cperciva
MFC after:	3 days
This commit is contained in:
Giorgos Keramidas 2007-11-02 15:11:53 +00:00
parent e56fbc5aad
commit 1d916e2c71
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=173282

View File

@ -164,7 +164,7 @@ main(int argc, char *argv[])
if (dir && chdir(dir))
err(1, "%s", dir);
if ((cflag || sflag) && !getwd(fullpath))
if ((cflag || sflag) && !getcwd(fullpath, sizeof(fullpath)))
errx(1, "%s", fullpath);
if (cflag) {