diff options
author | eadler <eadler@FreeBSD.org> | 2012-12-05 13:56:52 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2012-12-05 13:56:52 +0000 |
commit | dff4ef46f61862176e03fb0fd103ce56079ed597 (patch) | |
tree | f7eede52fc222836350de3ced8ca8494685ff678 /usr.sbin/pw | |
parent | 91505a47767c12d49081daedc8c16a7d396c66b1 (diff) | |
download | FreeBSD-src-dff4ef46f61862176e03fb0fd103ce56079ed597.zip FreeBSD-src-dff4ef46f61862176e03fb0fd103ce56079ed597.tar.gz |
Avoid overflowing the file buffer
Submitted by: db
Approved by: cperciva
MFC after: 2 weeks
Diffstat (limited to 'usr.sbin/pw')
-rw-r--r-- | usr.sbin/pw/rm_r.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/usr.sbin/pw/rm_r.c b/usr.sbin/pw/rm_r.c index 4ad590b..797ca9d 100644 --- a/usr.sbin/pw/rm_r.c +++ b/usr.sbin/pw/rm_r.c @@ -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 */ |