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>
This commit is contained in:
parent
107b801cf3
commit
65f7d41031
10
fs/fat/fat.c
10
fs/fat/fat.c
|
@ -672,6 +672,7 @@ read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
|
||||||
{
|
{
|
||||||
__u8 block[FS_BLOCK_SIZE];
|
__u8 block[FS_BLOCK_SIZE];
|
||||||
volume_info *vistart;
|
volume_info *vistart;
|
||||||
|
char *fstype;
|
||||||
|
|
||||||
if (disk_read(0, 1, block) < 0) {
|
if (disk_read(0, 1, block) < 0) {
|
||||||
FAT_DPRINT("Error: reading block\n");
|
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));
|
memcpy(volinfo, vistart, sizeof(volume_info));
|
||||||
|
|
||||||
/* Terminate fs_type string. Writing past the end of vistart
|
/*
|
||||||
is ok - it's just the buffer. */
|
* Terminate fs_type string. Writing past the end of vistart
|
||||||
vistart->fs_type[8] = '\0';
|
* is ok - it's just the buffer.
|
||||||
|
*/
|
||||||
|
fstype = vistart->fs_type;
|
||||||
|
fstype[8] = '\0';
|
||||||
|
|
||||||
if (*fatsize == 32) {
|
if (*fatsize == 32) {
|
||||||
if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {
|
if (compare_sign(FAT32_SIGN, vistart->fs_type) == 0) {
|
||||||
|
|
Loading…
Reference in New Issue