summaryrefslogtreecommitdiff
path: root/fs/fat
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-01-27 21:36:28 +0100
committerWolfgang Denk <wd@denx.de>2009-01-27 21:36:28 +0100
commit65f7d41031a70b1649b35020995c505edca91533 (patch)
treef7eed895ac6a4043cedd3dbc9b0121cd9af462ec /fs/fat
parent107b801cf3fe39612d69d70581ebc3bf5e215554 (diff)
fat.c: fix warning: array subscript is above array bounds
Fix based on suggestion by David Hawkins <dwh@ovro.caltech.edu>. Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'fs/fat')
-rw-r--r--fs/fat/fat.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 28c7805d0d5..8081ee7a837 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -672,6 +672,7 @@ read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
{
__u8 block[FS_BLOCK_SIZE];
volume_info *vistart;
+ char *fstype;
if (disk_read(0, 1, block) < 0) {
FAT_DPRINT("Error: reading block\n");
@@ -704,9 +705,12 @@ read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
}
memcpy(volinfo, vistart, sizeof(volume_info));
- /* Terminate fs_type string. Writing past the end of vistart
- is ok - it's just the buffer. */
- vistart->fs_type[8] = '\0';
+ /*
+ * Terminate fs_type string. Writing past the end of vistart
+ * is ok - it's just the buffer.
+ */
+ fstype = vistart->fs_type;
+ fstype[8] = '\0';
if (*fatsize == 32) {
if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {