From: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH] target-i386: cpu: fix potential buffer overrun in get_register_name_32()
Date: Tue, 04 Jun 2013 00:39:47 -0500 [thread overview]
Message-ID: <51AD7DA3.4070905@linux.vnet.ibm.com> (raw)
In-Reply-To: <1370276607-4180-1-git-send-email-imammedo@redhat.com>
On 06/03/2013 11:23 AM, Igor Mammedov wrote:
> spotted by Coverity,
> x86_reg_info_32[] is CPU_NB_REGS32 elements long, so accessing
> x86_reg_info_32[CPU_NB_REGS32] will be one element off array.
>
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
> target-i386/cpu.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 1a501d9..ae8e682 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -221,7 +221,7 @@ X86RegisterInfo32 x86_reg_info_32[CPU_NB_REGS32] = {
>
> const char *get_register_name_32(unsigned int reg)
> {
> - if (reg > CPU_NB_REGS32) {
> + if (reg >= CPU_NB_REGS32) {
> return NULL;
> }
> return x86_reg_info_32[reg].name;
>
Looks obvious now that it's been spotted. ;)
Reviewed by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Jesse Larrew
Software Engineer, KVM Team
IBM Linux Technology Center
Phone: (512) 973-2052 (T/L: 363-2052)
jlarrew@linux.vnet.ibm.com
next prev parent reply other threads:[~2013-06-04 5:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 16:23 [Qemu-devel] [PATCH] target-i386: cpu: fix potential buffer overrun in get_register_name_32() Igor Mammedov
2013-06-04 5:39 ` li guang
2013-06-04 5:39 ` Jesse Larrew [this message]
2013-06-04 12:20 ` Andreas Färber
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=51AD7DA3.4070905@linux.vnet.ibm.com \
--to=jlarrew@linux.vnet.ibm.com \
--cc=afaerber@suse.de \
--cc=imammedo@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 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.