lxc-ls: try to protect stack in recursive function
As ls_get() is non-tail recursive we face the inherent danger of blowing up the
stack at some level of nesting. To have at least some security we define
MAX_NESTLVL to be 5. That should be sufficient for most users. The argument lvl
to ls_get() can be used to keep track of the level of nesting we are at. If lvl
is greater than the allowed default level return (without error) and unwind the
stack.
--nesting gains an optional numeric argument. This allows the user to specify
the maximum level of nesting she/he wants to see. Fair warning: If your nesting
level is really deep and/or you have a lot of containers your might run into
trouble.
Signed-off-by:
Christian Brauner <christian.brauner@mailbox.org>
Acked-by:
Serge E. Hallyn <serge.hallyn@ubuntu.com>
Showing
Please
register
or
sign in
to comment