From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: afaerber@suse.de
Subject: [Qemu-devel] [PATCH] target-i386: cpu: fix potential buffer overrun in get_register_name_32()
Date: Mon, 3 Jun 2013 18:23:27 +0200 [thread overview]
Message-ID: <1370276607-4180-1-git-send-email-imammedo@redhat.com> (raw)
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;
--
1.7.1
next reply other threads:[~2013-06-03 16:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-03 16:23 Igor Mammedov [this message]
2013-06-04 5:39 ` [Qemu-devel] [PATCH] target-i386: cpu: fix potential buffer overrun in get_register_name_32() li guang
2013-06-04 5:39 ` Jesse Larrew
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=1370276607-4180-1-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=afaerber@suse.de \
--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).