isolinux: return failure when opening a zero-length file
authorH. Peter Anvin <hpa@zytor.com>
Tue, 2 Sep 2008 23:14:28 +0000 (16:14 -0700)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 2 Sep 2008 23:14:28 +0000 (16:14 -0700)
In the Syslinux view of the world, a zero-length file doesn't exist
and therefore should return error on open.  A lot of the code relies
on this, but ISOLINUX allowed a zero-length file to be opened, which
could cause all kinds of trouble.

It would be nicer to not have that restriction, but removing it will
probably not happen until the configuration code is rewritten in C.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
core/isolinux.asm

index f7c1366..f93b24e 100644 (file)
@@ -1232,7 +1232,8 @@ searchdir_iso:
                shr eax,SECTOR_SHIFT
                mov [bx+file_left],eax
                pop eax
-               and bx,bx                       ; ZF = 0
+               jz .failure                     ; Empty file?
+               ; ZF = 0
                mov si,bx
                pop es
                ret