There is a problem with "pc_default" if the following is present in
the config file (line order does matter):
UI gfxboot.com init
DEFAULT memtest
"pc_default" is called on the "DEFAULT" keyword, but
"getline" is skipped, so the code now tries to
parse the keywords parameter. The config line should be skipped in this case.
This could be fixed by converting "skipline" to a function and calling
it from "pc_default".
- Sebastian
diff --git a/core/parsecmd.inc b/core/parsecmd.inc
index edca0b7..27e115f 100644
--- a/core/parsecmd.inc
+++ b/core/parsecmd.inc
@@ -97,12 +97,18 @@ getcommand:
.eof: stc
ret
-.skipline: cmp al,10 ; Search for LF
+.skipline: call skipline
je .find
- call getc
jc .eof
jmp short .skipline
+skipline: cmp al,10 ; Search for LF
+ je .end
+ call getc
+ jc .end
+ jmp short skipline
+.end: ret
+
section .data
err_badcfg db 'Unknown keyword in configuration file: ',0
err_noparm db 'Missing parameter in configuration file. Keyword:
',0
diff --git a/core/parseconfig.inc b/core/parseconfig.inc
index fcf18d9..57ee5a5 100644
--- a/core/parseconfig.inc
+++ b/core/parseconfig.inc
@@ -26,7 +26,9 @@ pc_default: cmp ax,[DefaultLevel]
mov di,default_cmd
call getline
mov byte [di-1],0 ; null-terminate
-.skip: ret
+ ret
+.skip: call skipline
+ ret
;
; "ontimeout" command
Sebastian Herbszt wrote:> There is a problem with "pc_default" if the following is present in the config file (line order does matter): > > UI gfxboot.com init > DEFAULT memtest > > "pc_default" is called on the "DEFAULT" keyword, but "getline" is skipped, so the code now tries to > parse the keywords parameter. The config line should be skipped in this case. > > This could be fixed by converting "skipline" to a function and calling it from "pc_default". >Thanks! This patch didn't apply for me so I rewrote it, but the idea is the same. -hpa -- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
Possibly Parallel Threads
- [PATCH] parsecmd: show keyword in err_noparm message
- New "UI" directive broken?
- Automatically choose between 32-bit and 64-bit kernel
- [klibc:update-dash] [PARSER] Simplify EOF/newline handling in list parser
- [klibc:update-dash] dash: [PARSER] Simplify EOF/newline handling in list parser