From 3d0fb3a57e72d37356b6a765070b3a2289837f77 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Wed, 5 Dec 2012 13:56:52 +0000 Subject: Avoid overflowing the file buffer Submitted by: db Approved by: cperciva MFC after: 2 weeks --- pw/rm_r.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pw/rm_r.c b/pw/rm_r.c index 4ad590b..797ca9d 100644 --- a/pw/rm_r.c +++ b/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 */ -- cgit v1.2.3-56-ge451