2002-11-30 Yoshinori K. Okuji <okuji@enbug.org>
* stage2/disk_io.c (rawread): Make sure that SECTOR is valid. If not, set ERRNUM to ERR_GEOM and return zero. This check is critical when a partition table is corrupted.
This commit is contained in:
parent
a44e6361bc
commit
f5bc93e4de
3 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
2002-11-30 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
|
||||
* stage2/disk_io.c (rawread): Make sure that SECTOR is valid.
|
||||
If not, set ERRNUM to ERR_GEOM and return zero. This check is
|
||||
critical when a partition table is corrupted.
|
||||
|
||||
2002-11-28 Yoshinori K. Okuji <okuji@enbug.org>
|
||||
|
||||
* stage2/asm.S (console_cls): Write spaces to the entire screen
|
||||
|
|
|
@ -148,6 +148,13 @@ rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
|
|||
buf_track = -1;
|
||||
}
|
||||
|
||||
/* Make sure that SECTOR is valid. */
|
||||
if (sector < 0 || sector >= buf_geom.total_sectors)
|
||||
{
|
||||
errnum = ERR_GEOM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Get first sector of track */
|
||||
soff = sector % buf_geom.sectors;
|
||||
track = sector - soff;
|
||||
|
@ -381,8 +388,9 @@ static void
|
|||
attempt_mount (void)
|
||||
{
|
||||
#ifndef STAGE1_5
|
||||
for (fsys_type = 0; fsys_type < NUM_FSYS
|
||||
&& (*(fsys_table[fsys_type].mount_func)) () != 1; fsys_type++);
|
||||
for (fsys_type = 0; fsys_type < NUM_FSYS; fsys_type++)
|
||||
if ((fsys_table[fsys_type].mount_func) ())
|
||||
break;
|
||||
|
||||
if (fsys_type == NUM_FSYS && errnum == ERR_NONE)
|
||||
errnum = ERR_FSYS_MOUNT;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue