mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 22:32:30 +01:00
Avoid overflowing the file buffer
Submitted by: db Approved by: cperciva MFC after: 2 weeks
This commit is contained in:
parent
91d073903e
commit
dae7204032
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=243897
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user