Avoid overflowing the file buffer

Submitted by:	db
Approved by:	cperciva
MFC after:	2 weeks
This commit is contained in:
Eitan Adler 2012-12-05 13:56:52 +00:00
parent 91d073903e
commit dae7204032
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243897

View File

@ -52,7 +52,7 @@ rm_r(char const * dir, uid_t uid)
while ((e = readdir(d)) != NULL) {
if (strcmp(e->d_name, ".") != 0 && strcmp(e->d_name, "..") != 0) {
sprintf(file, "%s/%s", dir, e->d_name);
snprintf(file, sizeof(file), "%s/%s", dir, e->d_name);
if (lstat(file, &st) == 0) { /* Need symlinks, not
* linked file */
if (S_ISDIR(st.st_mode)) /* Directory - recurse */