diff options
author | Igor Mammedov <imammedo@redhat.com> | 2013-06-03 18:23:27 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-06-10 23:33:19 +0200 |
commit | 31ccdde298d98b08526dc23059071c9086dec6c2 (patch) | |
tree | 104f3283404a29387748b043fea20635fdd2e998 /target-i386/cpu.c | |
parent | 6b11322e0f724eb0649fdc324a44288b783023ad (diff) | |
download | hqemu-31ccdde298d98b08526dc23059071c9086dec6c2.zip hqemu-31ccdde298d98b08526dc23059071c9086dec6c2.tar.gz |
target-i386: cpu: Fix potential buffer overrun in get_register_name_32()
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>
Reviewed-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed by: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-i386/cpu.c')
-rw-r--r-- | 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 762baad..4b2da0d 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; |