#97 Bugs in FAT12/16 boot sector loaders if file not found

Kernel (32)
C. Masloch

In the current boot.asm at line 252 the jc should be an unconditional jump instead. The jc is never going to jump; this is a bug. It could cause a crash if the file is not found (by loading some arbitrary file's data and executing it, even though it isn't a kernel).

There is a second bug even then: if no entries are found, and none of the root entries have zero in the first byte, then the loop back to next_entry is going to scan uninitialised memory (until it encounters a zero or a match). This is an unlikely situation but could plausibly exist if the root directory had become filled up entirely once.

Additionally, it would be more robust if the division determining the number of root sectors would round up. This is usually not a problem in practice though, as file systems are typically formatted with a number of root entries that makes rounding unnecessary.

I am referring to this boot.asm, as of now the latest (SVN r1493): http://freedos.svn.sourceforge.net/viewvc/freedos/kernel/trunk/boot/boot.asm?revision=1493&view=markup

In the current oemboot.asm the first bug exists similarly except here the jump is missing completely, it should be after line 342.

The current oemboot.asm also shares the bug about scanning uninitialised entries if neither entries with byte zero nor matches are found.

Additionally oemboot.asm shares the lack of robust rounding in the root entries division, which as mentioned is not usually a problem.

I am referring to this oemboot.asm, as of now the latest (SVN r1482): http://freedos.svn.sourceforge.net/viewvc/freedos/kernel/trunk/boot/oemboot.asm?revision=1482&view=markup

The latest boot32.asm and boot32lb.asm (both SVN r751) are not affected.

I can prepare patches if you're interested.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks