qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Gleb Natapov <gleb@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Out off array access in usb-net
Date: Tue, 09 Nov 2010 10:30:54 +0100	[thread overview]
Message-ID: <m3eiaun8s1.fsf@blackfin.pond.sub.org> (raw)
In-Reply-To: <20101109073653.GF9036@redhat.com> (Gleb Natapov's message of "Tue, 9 Nov 2010 09:36:53 +0200")

Gleb Natapov <gleb@redhat.com> writes:

> Properly check array bounds before accessing array element.

Impact?

Apply to stable as well?

> Signed-off-by: Gleb Natapov <gleb@redhat.com>
> diff --git a/hw/usb-net.c b/hw/usb-net.c
> index 70f9263..84e2d79 100644
> --- a/hw/usb-net.c
> +++ b/hw/usb-net.c
> @@ -1142,7 +1142,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
>                  break;
>  
>              default:
> -                if (usb_net_stringtable[value & 0xff]) {
> +                if (ARRAY_SIZE(usb_net_stringtable) > (value & 0xff)) {
>                      ret = set_usb_string(data,
>                                      usb_net_stringtable[value & 0xff]);
>                      break;

Makes sense.

Nitpick: LIMIT > INDEX looks unusual to me; INDEX < LIMIT is more
common.

  parent reply	other threads:[~2010-11-09  9:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09  7:36 [Qemu-devel] [PATCH] Out off array access in usb-net Gleb Natapov
2010-11-09  9:29 ` [Qemu-devel] " Paolo Bonzini
2010-11-09  9:30 ` Markus Armbruster [this message]
2010-11-09  9:39   ` [Qemu-devel] " Gleb Natapov
2010-11-09 10:16     ` Markus Armbruster
2010-11-09 10:34       ` Gleb Natapov
2010-11-09 10:51         ` Markus Armbruster
2010-11-16 20:08           ` Anthony Liguori
2010-11-16 20:14             ` Gleb Natapov
2010-11-16 22:24 ` Anthony Liguori

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=m3eiaun8s1.fsf@blackfin.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=gleb@redhat.com \
    --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).