From 65f7d41031a70b1649b35020995c505edca91533 Mon Sep 17 00:00:00 2001 From: Wolfgang Denk Date: Tue, 27 Jan 2009 21:36:28 +0100 Subject: fat.c: fix warning: array subscript is above array bounds Fix based on suggestion by David Hawkins . Signed-off-by: Wolfgang Denk --- fs/fat/fat.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'fs/fat') diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 28c7805..8081ee7 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) { -- cgit v1.1