From: Will Deacon <will.deacon@arm.com>
To: "G. Campana" <gcampana+kvm@quarkslab.com>
Cc: kvm@vger.kernel.org, andre.przywara@arm.com
Subject: Re: [PATCH 1/7] kvmtool: 9p: fix path traversal vulnerabilities
Date: Tue, 8 Nov 2016 01:48:29 +0000 [thread overview]
Message-ID: <20161108014829.GU20591@arm.com> (raw)
In-Reply-To: <1476806558-9694-1-git-send-email-gcampana+kvm@quarkslab.com>
On Tue, Oct 18, 2016 at 06:02:38PM +0200, G. Campana wrote:
> ---
> virtio/9p.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 55 insertions(+)
>
> diff --git a/virtio/9p.c b/virtio/9p.c
> index 49e7c5c..c3edc20 100644
> --- a/virtio/9p.c
> +++ b/virtio/9p.c
> @@ -222,6 +222,21 @@ static bool is_dir(struct p9_fid *fid)
> return S_ISDIR(st.st_mode);
> }
>
> +/* path is always absolute */
> +static bool path_is_illegal(const char *path)
> +{
> + size_t len;
> +
> + if (strstr(path, "/../") != NULL)
> + return true;
> +
> + len = strlen(path);
> + if (len >= 3 && strcmp(path + len - 3, "/..") == 0)
> + return true;
Why not just look for ".." and ignore the slashes altogether? Then you
wouldn't need to treat the end of the string specially, either.
Will
next prev parent reply other threads:[~2016-11-08 1:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-18 16:02 [PATCH 1/7] kvmtool: 9p: fix path traversal vulnerabilities G. Campana
2016-10-20 18:13 ` Andre Przywara
2016-10-25 11:34 ` G. Campana
2016-11-08 1:48 ` Will Deacon [this message]
2016-11-10 15:13 ` G. Campana
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161108014829.GU20591@arm.com \
--to=will.deacon@arm.com \
--cc=andre.przywara@arm.com \
--cc=gcampana+kvm@quarkslab.com \
--cc=kvm@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.