From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Cc: public@hansmi.ch
Subject: Re: [Qemu-devel] [PATCH for-3.1 v2 2/2] usb-mtp: outlaw slashes in filenames
Date: Mon, 3 Dec 2018 10:45:18 +0100 [thread overview]
Message-ID: <2c987f8a-1614-de5d-a890-fdefc0a2cb12@redhat.com> (raw)
In-Reply-To: <20181203085938.10247-3-kraxel@redhat.com>
On 3/12/18 9:59, Gerd Hoffmann wrote:
> Slash is unix directory separator, so they are not allowed in filenames.
> Note this also stops the classic escape via "../".
>
> Fixes: CVE-2018-16867
> Reported-by: Michael Hanselmann <public@hansmi.ch>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/usb/dev-mtp.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
> index 0f6a9702ef..e340a2c6e3 100644
> --- a/hw/usb/dev-mtp.c
> +++ b/hw/usb/dev-mtp.c
> @@ -1719,6 +1719,12 @@ static void usb_mtp_write_metadata(MTPState *s)
>
> filename = utf16_to_str(dataset->length, dataset->filename);
>
> + if (strchr(filename, '/')) {
> + usb_mtp_queue_result(s, PARAMETER_NOT_SUPPORTED, d->trans,
> + 0, 0, 0, 0);
> + return;
> + }
> +
> o = usb_mtp_object_lookup_name(p, filename, dataset->length);
> if (o != NULL) {
> next_handle = o->handle;
>
next prev parent reply other threads:[~2018-12-03 9:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-03 8:59 [Qemu-devel] [PATCH for-3.1 v2 0/2] usb-mtp: two bugfixes (one security fix) Gerd Hoffmann
2018-12-03 8:59 ` [Qemu-devel] [PATCH for-3.1 v2 1/2] usb-mtp: fix utf16_to_str Gerd Hoffmann
2018-12-03 8:59 ` [Qemu-devel] [PATCH for-3.1 v2 2/2] usb-mtp: outlaw slashes in filenames Gerd Hoffmann
2018-12-03 9:45 ` Philippe Mathieu-Daudé [this message]
2018-12-03 9:30 ` [Qemu-devel] [PATCH for-3.1 v2 0/2] usb-mtp: two bugfixes (one security fix) no-reply
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=2c987f8a-1614-de5d-a890-fdefc0a2cb12@redhat.com \
--to=philmd@redhat.com \
--cc=kraxel@redhat.com \
--cc=public@hansmi.ch \
--cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).