Detect null filenames correctly (problems in both pxelinux and extlinux)
authorhpa <hpa>
Wed, 22 Dec 2004 13:40:56 +0000 (13:40 +0000)
committerhpa <hpa>
Wed, 22 Dec 2004 13:40:56 +0000 (13:40 +0000)
extlinux.asm
isolinux.asm
ldlinux.asm
pxelinux.asm
runkernel.inc
ui.inc

index fffeb89..bb6215d 100644 (file)
@@ -32,7 +32,8 @@ my_id         equ extlinux_id
 ; NASM 0.98.38 croaks if these are equ's rather than macros...
 FILENAME_MAX_LG2 equ 8                 ; log2(Max filename size Including final null)
 FILENAME_MAX   equ (1 << FILENAME_MAX_LG2)     ; Max mangled filename size
-NULLFILE       equ ' '                 ; First char space == null filename
+NULLFILE       equ 0                   ; Null character == empty filename
+NULLOFFSET     equ 0                   ; Position in which to look
 retry_count    equ 6                   ; How patient are we with the disk?
 %assign HIGHMEM_SLOP 0                 ; Avoid this much memory near the top
 LDLINUX_MAGIC  equ 0x3eb202fe          ; A random number to identify ourselves with
index 548811e..78e642a 100644 (file)
@@ -33,6 +33,7 @@ my_id         equ isolinux_id
 FILENAME_MAX_LG2 equ 8                 ; log2(Max filename size Including final null)
 FILENAME_MAX   equ (1 << FILENAME_MAX_LG2)
 NULLFILE       equ 0                   ; Zero byte == null file name
+NULLOFFSET     equ 0                   ; Position in which to look
 retry_count    equ 6                   ; How patient are we with the BIOS?
 %assign HIGHMEM_SLOP 128*1024          ; Avoid this much memory near the top
 MAX_OPEN_LG2   equ 6                   ; log2(Max number of open files)
index 583106b..badbf76 100644 (file)
@@ -38,6 +38,7 @@ my_id         equ syslinux_id
 FILENAME_MAX_LG2 equ 4                 ; log2(Max filename size Including final null)
 FILENAME_MAX   equ 11                  ; Max mangled filename size
 NULLFILE       equ ' '                 ; First char space == null filename
+NULLOFFSET     equ 0                   ; Position in which to look
 retry_count    equ 6                   ; How patient are we with the disk?
 %assign HIGHMEM_SLOP 0                 ; Avoid this much memory near the top
 LDLINUX_MAGIC  equ 0x3eb202fe          ; A random number to identify ourselves with
index a0328f4..329c7f8 100644 (file)
@@ -33,6 +33,7 @@ my_id         equ pxelinux_id
 FILENAME_MAX_LG2 equ 7                 ; log2(Max filename size Including final null)
 FILENAME_MAX   equ (1 << FILENAME_MAX_LG2)
 NULLFILE       equ 0                   ; Zero byte == null file name
+NULLOFFSET     equ 4                   ; Position in which to look
 REBOOT_TIME    equ 5*60                ; If failure, time until full reset
 %assign HIGHMEM_SLOP 128*1024          ; Avoid this much memory near the top
 MAX_OPEN_LG2   equ 5                   ; log2(Max number of open sockets)
index 148d083..7a71350 100644 (file)
@@ -162,7 +162,7 @@ get_next_opt:   lodsb
                 push si                         ; mangle_dir mangles si
                 call mangle_name                ; Mangle ramdisk name
                 pop si
-               cmp byte [es:InitRD],NULLFILE   ; Null filename?
+               cmp byte [es:InitRD+NULLOFFSET],NULLFILE ; Null filename?
                 seta byte [es:initrd_flag]     ; Set flag if not
 not_initrd:    pop es                          ; Restore ES -> real_mode_seg
 skip_this_opt:  lodsb                           ; Load from command line
diff --git a/ui.inc b/ui.inc
index 33b69dd..246b66c 100644 (file)
--- a/ui.inc
+++ b/ui.inc
@@ -143,7 +143,7 @@ show_help:  ; AX = func key # (0 = F1, 9 = F10)
                shl ax,FILENAME_MAX_LG2         ; Convert to pointer
                add ax,FKeyName
                xchg di,ax
-               cmp byte [di],NULLFILE
+               cmp byte [di+NULLOFFSET],NULLFILE
                je short fk_nofile              ; Undefined F-key
                call searchdir
                jz short fk_nofile              ; File not found