qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 06/28] 9pfs: local: open/opendir: don't follo


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH v2 06/28] 9pfs: local: open/opendir: don't follow symlinks
Date: Mon, 27 Feb 2017 12:49:01 +0000
User-agent: Mutt/1.7.1 (2016-10-04)

On Sun, Feb 26, 2017 at 11:42:18PM +0100, Greg Kurz wrote:
> @@ -48,6 +49,24 @@ typedef struct {
>      int mountfd;
>  } LocalData;
>  
> +int local_open_nofollow(FsContext *fs_ctx, const char *path, int flags,
> +                        mode_t mode)
> +{
> +    LocalData *data = fs_ctx->private;
> +
> +    /* All paths are relative to the path data->mountfd points to */
> +    while (*path == '/') {
> +        path++;
> +    }
> +
> +    return openat_nofollow(data->mountfd, path, flags, mode);

What about all the other openat_nofollow() users?  They don't explicitly
strip leading slashes.  Perhaps this should be part of a renamed
relative_openat_nofollow() function.

> +}
> +
> +int local_opendir_nofollow(FsContext *fs_ctx, const char *path)
> +{
> +    return local_open_nofollow(fs_ctx, path, O_DIRECTORY | O_RDONLY, 0);

Why not strip slashes here?

Attachment: signature.asc
Description: PGP signature


reply via email to

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