From 72d098b31e57e5ae81d9a4923608f12014c1d36f Mon Sep 17 00:00:00 2001 From: hpa Date: Wed, 22 Dec 2004 13:40:56 +0000 Subject: [PATCH] Detect null filenames correctly (problems in both pxelinux and extlinux) --- extlinux.asm | 3 ++- isolinux.asm | 1 + ldlinux.asm | 1 + pxelinux.asm | 1 + runkernel.inc | 2 +- ui.inc | 2 +- 6 files changed, 7 insertions(+), 3 deletions(-) diff --git a/extlinux.asm b/extlinux.asm index fffeb89..bb6215d 100644 --- a/extlinux.asm +++ b/extlinux.asm @@ -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 diff --git a/isolinux.asm b/isolinux.asm index 548811e..78e642a 100644 --- a/isolinux.asm +++ b/isolinux.asm @@ -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) diff --git a/ldlinux.asm b/ldlinux.asm index 583106b..badbf76 100644 --- a/ldlinux.asm +++ b/ldlinux.asm @@ -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 diff --git a/pxelinux.asm b/pxelinux.asm index a0328f4..329c7f8 100644 --- a/pxelinux.asm +++ b/pxelinux.asm @@ -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) diff --git a/runkernel.inc b/runkernel.inc index 148d083..7a71350 100644 --- a/runkernel.inc +++ b/runkernel.inc @@ -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 --- 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 -- 2.7.4