diff options
author | H. Peter Anvin <hpa@zytor.com> | 2009-06-09 07:29:13 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2009-06-09 07:29:13 -0700 |
commit | 1feb9b05ea0b9690a5e5af8b5919d63d6979a2eb (patch) | |
tree | 2832fc3b3b7d70d98b9a1a33bf4a28599560eb81 | |
parent | 6e969f3b4359125780868d9747bc59bbeee86a9e (diff) | |
download | syslinux.git-1feb9b05ea0b9690a5e5af8b5919d63d6979a2eb.tar.gz syslinux.git-1feb9b05ea0b9690a5e5af8b5919d63d6979a2eb.tar.xz syslinux.git-1feb9b05ea0b9690a5e5af8b5919d63d6979a2eb.zip |
pxelinux: cleaner test for OACK trailing null bytes
Instead of looking for a string of null bytes at the end of the OACK
string, simply abort parsing if we run into a null byte where an
option is expected; either we are seeing junk at the end of the
packet, or we are hopelessly confused about how to make sense of the
rest of the packet -- in either case, ignoring is the "liberal"
option.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | core/pxelinux.asm | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/core/pxelinux.asm b/core/pxelinux.asm index de1b10c3..cbfae52f 100644 --- a/core/pxelinux.asm +++ b/core/pxelinux.asm @@ -1105,16 +1105,16 @@ searchdir: ; SI -> first byte of options; [E]CX -> byte count .parse_oack: jcxz .done_pkt ; No options acked -.get_opt_name: - ; Some TFTP servers have junk NUL bytes at the end of the packet. - ; If all that is left is NUL, then consider the packet processed. - mov di,si - push cx - xor ax,ax - repz scasb - pop cx - jz .done_pkt + ; If we find an option which starts with a NUL byte, + ; (a null option), we're either seeing garbage that some + ; TFTP servers add to the end of the packet, or we have + ; no clue how to parse the rest of the packet (what is + ; an option name and what is a value?) In either case, + ; discard the rest. + cmp byte [si],0 + je .done_pkt +.get_opt_name: mov di,si mov bx,si .opt_name_loop: lodsb |