bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

eliminating find's recursion-related stack limitation


From: Jim Meyering
Subject: eliminating find's recursion-related stack limitation
Date: Sun, 23 Jan 2005 19:40:59 +0100

Hi James,

Have you considered changing GNU find not to use explicit recursion?
I didn't see it listed in findutils' TODO file.

Currently, a malicious user can easily arrange so that find does not
process some files: just put them so deep (say 50,000 levels down)
in a hierarchy that find would blow its stack and segfault before
getting that far.  Of course, such a deep hierarchy would also disrupt
periodic updatedb runs, unless someone thinks to limit the depth (e.g.,
via -maxdepth) of the updatedb-invoked find command.

I converted GNU rm, chmod, chown, chgrp, and du from using explicit
recursion to using stateful iteration via fts.
ls and cp still remain to be converted, but are less important.
fts worked well for the latter four, but perhaps find is too demanding.
Unfortunately, to properly evaluate such a solution seems to require
doing most of the work of converting the tool to use fts.

Jim




reply via email to

[Prev in Thread] Current Thread [Next in Thread]