diff options
author | Eitan Adler <eadler@FreeBSD.org> | 2012-12-05 13:56:52 +0000 |
---|---|---|
committer | Eitan Adler <eadler@FreeBSD.org> | 2012-12-05 13:56:52 +0000 |
commit | 3d0fb3a57e72d37356b6a765070b3a2289837f77 (patch) | |
tree | 8673dd044ae27985a865d8b2b9ab4d03020bfe03 | |
parent | 3ed3b62bd35ad2bc1ec73c566c5b1c49b6ba8bc1 (diff) | |
download | pw-darwin-3d0fb3a57e72d37356b6a765070b3a2289837f77.tar.gz pw-darwin-3d0fb3a57e72d37356b6a765070b3a2289837f77.tar.zst pw-darwin-3d0fb3a57e72d37356b6a765070b3a2289837f77.zip |
Avoid overflowing the file buffer
Submitted by: db
Approved by: cperciva
MFC after: 2 weeks
-rw-r--r-- | pw/rm_r.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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 */ |