From: Geert Uytterhoeven Date: Tue, 12 Feb 2013 09:06:12 +0000 (+0100) Subject: cris/kgdb: Fix buffer overflow in getpacket() X-Git-Tag: next-20130607~122^2~25 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9d2bb30feecc1f5b0d97bdda09042e3d451e429d;p=karo-tx-linux.git cris/kgdb: Fix buffer overflow in getpacket() arch/cris/arch-v10/kernel/kgdb.c: In function 'handle_exception': arch/cris/arch-v10/kernel/kgdb.c:534:17: warning: array subscript is above array bounds [-Warray-bounds] Signed-off-by: Geert Uytterhoeven --- diff --git a/arch/cris/arch-v10/kernel/kgdb.c b/arch/cris/arch-v10/kernel/kgdb.c index d0b6257afc2c..0e799073498d 100644 --- a/arch/cris/arch-v10/kernel/kgdb.c +++ b/arch/cris/arch-v10/kernel/kgdb.c @@ -523,7 +523,7 @@ getpacket (char *buffer) xmitcsum = -1; count = 0; /* Read until a # or the end of the buffer is reached */ - while (count < BUFMAX) { + while (count < BUFMAX - 1) { ch = getDebugChar (); if (ch == '#') break;