qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Greg Kurz <groug@kaod.org>
Cc: qemu-devel@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
	Jason Wang <jasowang@redhat.com>, Fam Zheng <famz@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 5/7] tests: virtio-9p: add WRITE operation test
Date: Mon, 29 Jan 2018 21:14:31 +0000	[thread overview]
Message-ID: <20180129211431.GA1640@stefanha-x1.localdomain> (raw)
In-Reply-To: <151675076332.29381.6289851186190918274.stgit@bahia.lan>

[-- Attachment #1: Type: text/plain, Size: 689 bytes --]

On Wed, Jan 24, 2018 at 12:39:23AM +0100, Greg Kurz wrote:
> +/* size[4] Twrite tag[2] fid[4] offset[8] count[4] data[count] */
> +static P9Req *v9fs_twrite(QVirtIO9P *v9p, uint32_t fid, uint64_t offset,
> +                          uint32_t count, const void *data, uint16_t tag)
> +{
> +    P9Req *req;
> +
> +    req = v9fs_req_init(v9p,  4 + 8 + 4 + count, P9_TWRITE, tag);

(uint32_t)(4 + 8 + 4 + (uint32_t)count) can overflow.  I didn't look
closely at the code and it's just a test case, but it seems safer to use
types that avoid overflows or to handle them explicitly.

It may not be an issue in a test case, but if someone copy pastes this
code it could become a security issue.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

  reply	other threads:[~2018-01-29 21:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 23:38 [Qemu-devel] [PATCH 0/7] tests: virtio-9p: test request cancellation Greg Kurz
2018-01-23 23:38 ` [Qemu-devel] [PATCH 1/7] tests: virtio-9p: move request tag to the test functions Greg Kurz
2018-01-23 23:38 ` [Qemu-devel] [PATCH 2/7] tests: virtio-9p: wait for completion in the test code Greg Kurz
2018-01-23 23:39 ` [Qemu-devel] [PATCH 3/7] tests: virtio-9p: use the synth backend Greg Kurz
2018-01-23 23:39 ` [Qemu-devel] [PATCH 4/7] tests: virtio-9p: add LOPEN operation test Greg Kurz
2018-01-23 23:39 ` [Qemu-devel] [PATCH 5/7] tests: virtio-9p: add WRITE " Greg Kurz
2018-01-29 21:14   ` Stefan Hajnoczi [this message]
2018-01-30  8:25     ` Greg Kurz
2018-01-23 23:39 ` [Qemu-devel] [PATCH 6/7] libqos/virtio: return length written into used descriptor Greg Kurz
2018-01-23 23:39 ` [Qemu-devel] [PATCH 7/7] tests: virtio-9p: add FLUSH operation test Greg Kurz
2018-01-29 21:20 ` [Qemu-devel] [PATCH 0/7] tests: virtio-9p: test request cancellation Stefan Hajnoczi

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=20180129211431.GA1640@stefanha-x1.localdomain \
    --to=stefanha@gmail.com \
    --cc=famz@redhat.com \
    --cc=groug@kaod.org \
    --cc=jasowang@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).