On Thu, 2021-04-08 at 17:25 +0100, Ross Burton wrote:
> The pseudo client path map stores paths that have been sanitised, but
> in the ignored-path (PSEUDO_IGNORE_PATHS) codepath for open() calls this
> sanitising wasn't performed so it is possible for paths that end with a
> trailing slash to be entered.
> 
> This then subsequently interacts badly with path manipulation, resulting
> in the situation where doing:
> 
>   fd = open("/some/path/")
>   parent_fd = openat(fd, "../)
> 
> results in parent_fd actually pointing at /some/path still.
> 
> Solve this by ensuring that any trailing slashes are removed from the
> path when adding to the map in the ignore short-circuit.
> 
> Also add a test case for this to ensure that it doesn't regress in the
> future.
> 
> Signed-off-by: Ross Burton <[email protected]>
> ---
>  Makefile.in         |  1 +
>  pseudo_client.c     | 11 ++++++++-
>  test/test-openat.c  | 55 +++++++++++++++++++++++++++++++++++++++++++++
>  test/test-openat.sh |  7 ++++++
>  4 files changed, 73 insertions(+), 1 deletion(-)
>  create mode 100644 test/test-openat.c
>  create mode 100755 test/test-openat.sh

Merged to the oe-core branch, thanks. Bonus kudos for a new test! :)

Cheers,

Richard

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#150343): 
https://lists.openembedded.org/g/openembedded-core/message/150343
Mute This Topic: https://lists.openembedded.org/mt/81946728/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to