qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] target-i386: cpu: fix potential buffer overrun in get_register_name_32()
@ 2013-06-03 16:23 Igor Mammedov
  2013-06-04  5:39 ` li guang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Igor Mammedov @ 2013-06-03 16:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: afaerber

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-04 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-06-04 12:20 ` Andreas Färber

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).