From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:33262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8lxa-0000mu-48 for qemu-devel@nongnu.org; Tue, 04 Sep 2012 01:46:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T8lxZ-0005rv-85 for qemu-devel@nongnu.org; Tue, 04 Sep 2012 01:46:02 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:55016) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T8lxZ-0005rr-1H for qemu-devel@nongnu.org; Tue, 04 Sep 2012 01:46:01 -0400 From: Stefan Weil Date: Tue, 4 Sep 2012 07:45:52 +0200 Message-Id: <1346737552-2390-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH] target-cris: Fix buffer overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Edgar E. Iglesias" Cc: Stefan Weil , qemu-devel@nongnu.org Report from smatch: target-cris/translate.c:3464 cpu_dump_state(32) error: buffer overflow 'env->sregs' 4 <= 255 sregs is declared 'uint32_t sregs[4][16]', so the first index must be less than 4. Signed-off-by: Stefan Weil --- I did not fix tabs, therefore checkpatch.pl reports an error. target-cris/translate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target-cris/translate.c b/target-cris/translate.c index 1ad9ec7..34c0452 100644 --- a/target-cris/translate.c +++ b/target-cris/translate.c @@ -3458,7 +3458,7 @@ void cpu_dump_state (CPUCRISState *env, FILE *f, fprintf_function cpu_fprintf, } srs = env->pregs[PR_SRS]; cpu_fprintf(f, "\nsupport function regs bank %x:\n", srs); - if (srs < 256) { + if (srs < 4) { for (i = 0; i < 16; i++) { cpu_fprintf(f, "s%2.2d=%8.8x ", i, env->sregs[srs][i]); -- 1.7.10