public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] net: Fix TftpStart() ip:filename bug
@ 2008-12-01 22:29 Peter Tyser
  2008-12-05  7:08 ` Ben Warren
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Tyser @ 2008-12-01 22:29 UTC (permalink / raw)
  To: u-boot

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: Peter Tyser <ptyser@xes-inc.com>
---
doah, forgot SOB

 net/tftp.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/net/tftp.c b/net/tftp.c
index ce6ea3d..3dac3d8 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -499,9 +499,8 @@ TftpStart (void)
 			strncpy(tftp_filename, BootFile, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		} else {
-			*p++ = '\0';
 			TftpServerIP = string_to_ip (BootFile);
-			strncpy(tftp_filename, p, MAX_LEN);
+			strncpy(tftp_filename, p + 1, MAX_LEN);
 			tftp_filename[MAX_LEN-1] = 0;
 		}
 	}
-- 
1.6.0.2.GIT

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-05  7:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-01 22:29 [U-Boot] [PATCH v2] net: Fix TftpStart() ip:filename bug Peter Tyser
2008-12-05  7:08 ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox