Re: [hackers] [sbase] [PATCH] ls: allow listing contents of directories with +r-x

From: Richard Ipsum <richardipsum_AT_fastmail.co.uk>
Date: Sat, 21 Oct 2017 14:17:25 +0100

On Tue, Oct 17, 2017 at 10:27:44PM +1300, David Phillips wrote:
> chdir()ing into a directory with +r-x fails, so we should manually use the
> directory name as a prefix rather than chdir()ing into it.
>
> Also adds new parameters to mkent for the prefix, and for dictating whether
> or not a permission denied error when stat()ing shall be fatal or not. This
> allows errors stat()ing children of `foo` to be reported and non-fatal, while
> a permission denied error on `foo` itself would be fatal.
> ---
> ls.c | 33 +++++++++++++++++++++++----------
> 1 file changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/ls.c b/ls.c
> index b716aba..c01a277 100644
> --- a/ls.c
> +++ b/ls.c
[snip]
> struct stat st;
> + char path[PATH_MAX];

Please correct me if I'm wrong but I'm given to understand that PATH_MAX
is not a safe value to use here.[1]

[1]: http://insanecoding.blogspot.co.uk/2007/11/pathmax-simply-isnt.html

Thanks,
Richard
Received on Sat Oct 21 2017 - 15:17:25 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 21 2017 - 15:24:20 CEST