From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UliCu-0002DJ-7Z for qemu-devel@nongnu.org; Sun, 09 Jun 2013 12:11:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UliCs-0001t7-MR for qemu-devel@nongnu.org; Sun, 09 Jun 2013 12:11:04 -0400 Received: from cantor2.suse.de ([195.135.220.15]:39870 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UliCs-0001sx-GA for qemu-devel@nongnu.org; Sun, 09 Jun 2013 12:11:02 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Sun, 9 Jun 2013 18:10:35 +0200 Message-Id: <1370794247-28267-7-git-send-email-afaerber@suse.de> In-Reply-To: <1370794247-28267-1-git-send-email-afaerber@suse.de> References: <1370794247-28267-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH qom-cpu v4 06/18] target-i386: cpu: Fix potential buffer overrun in get_register_name_32() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Igor Mammedov , qiaonuohan@cn.fujitsu.com, =?UTF-8?q?Andreas=20F=C3=A4rber?= , lcapitulino@redhat.com From: Igor Mammedov 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 Reviewed-by: liguang Reviewed by: Jesse Larrew Signed-off-by: Andreas F=C3=A4rber --- target-i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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] =3D = { =20 const char *get_register_name_32(unsigned int reg) { - if (reg > CPU_NB_REGS32) { + if (reg >=3D CPU_NB_REGS32) { return NULL; } return x86_reg_info_32[reg].name; --=20 1.8.1.4