From: Jean-Christophe PLAGNIOL-VILLARD Date: Sat, 13 Dec 2008 23:22:25 +0100 Subject: [U-Boot] fat.c:707: warning: array subscript is above array bounds In-Reply-To: <20081213221301.C91B0832E8A1@gemini.denx.de> References: <20081213221301.C91B0832E8A1@gemini.denx.de> Message-ID: <20081213222225.GN15295@game.jcrosoft.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 23:13 Sat 13 Dec , Wolfgang Denk wrote: > Hello, > > building U-Boot with recent toolchains (like GCC-4.3.2) results in > this warning: > > fat.c: In function 'read_bootsectandvi': > fat.c:707: warning: array subscript is above array bounds > > The respective code looks like this: > > fs/fat/fat.c: > > 705 /* Terminate fs_type string. Writing past the end of vistart > 706 is ok - it's just the buffer. */ > 707 vistart->fs_type[8] = '\0'; why not do something like this *(vistart + sizeof(volume_info)) = '\0'; Best Regards, J.