提交 6a86bb6c 编写于 作者: P Peter Tyser 提交者: Ben Warren

net: Fix TftpStart() ip:filename bug

The TftpStart() function modifies the 'BootFile'
string when 'BootFile' contains both an IP address
and filename (eg 1.2.3.4:/path/file). This causes
subsequent calls to TftpStart to incorrectly parse
the TFTP filename and server IP address to use.
For example:

=> tftp 0x100000 10.52.0.62:/home/ptyser/non_existant
Speed: 100, half duplex
Using eTSEC1 device
TFTP from server 10.52.0.62; our IP address is 10.52.253.79
                 ^^^^^^^^^^ CORRECT
Filename '/home/ptyser/non_existant'.
          ^^^^^^^^^^^^^^^^^^^^^^^^^ CORRECT
Load address: 0x100000
Loading: *
TFTP error: 'File not found' (1)
Starting again

eTSEC2: No link.
Speed: 100, half duplex
Using eTSEC1 device
TFTP from server 10.52.0.33; our IP address is 10.52.253.79
                 ^^^^^^^^^^ WRONG
Filename '10.52.0.62'.
          ^^^^^^^^^^ WRONG
Load address: 0x100000
Loading: *
TFTP error: 'File not found' (1)
Starting again

TftpStart() was modified to not modify the 'BootFile' string.
Signed-off-by: NPeter Tyser <ptyser@xes-inc.com>
Signed-off-by: NBen Warren <biggerbadderben@gmail.com>
上级 d32c5be5
...@@ -499,9 +499,8 @@ TftpStart (void) ...@@ -499,9 +499,8 @@ TftpStart (void)
strncpy(tftp_filename, BootFile, MAX_LEN); strncpy(tftp_filename, BootFile, MAX_LEN);
tftp_filename[MAX_LEN-1] = 0; tftp_filename[MAX_LEN-1] = 0;
} else { } else {
*p++ = '\0';
TftpServerIP = string_to_ip (BootFile); TftpServerIP = string_to_ip (BootFile);
strncpy(tftp_filename, p, MAX_LEN); strncpy(tftp_filename, p + 1, MAX_LEN);
tftp_filename[MAX_LEN-1] = 0; tftp_filename[MAX_LEN-1] = 0;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册