diff options
author | Wolfgang Denk <wd@denx.de> | 2008-12-09 01:00:24 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-12-09 01:00:24 +0100 |
commit | c645b181a9a848996d54a5e358bedabae1da566a (patch) | |
tree | a05030fe0bfc31b049a2d498e0e8090816f28352 /common | |
parent | 5e3ab68e9acf9edf304b8aa32ad7e005483a2c47 (diff) | |
parent | 6a86bb6c25376f0358478219fa28d7c84dd01ed0 (diff) | |
download | u-boot-imx-c645b181a9a848996d54a5e358bedabae1da566a.zip u-boot-imx-c645b181a9a848996d54a5e358bedabae1da566a.tar.gz u-boot-imx-c645b181a9a848996d54a5e358bedabae1da566a.tar.bz2 |
Merge branch 'master' of git://git.denx.de/u-boot-net
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_net.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/common/cmd_net.c b/common/cmd_net.c index af691a4..c053d7b 100644 --- a/common/cmd_net.c +++ b/common/cmd_net.c @@ -154,8 +154,10 @@ static int netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[]) { char *s; + char *end; int rcode = 0; int size; + ulong addr; /* pre-set load_addr */ if ((s = getenv("loadaddr")) != NULL) { @@ -166,15 +168,17 @@ netboot_common (proto_t proto, cmd_tbl_t *cmdtp, int argc, char *argv[]) case 1: break; - case 2: /* only one arg - accept two forms: - * just load address, or just boot file name. - * The latter form must be written "filename" here. + case 2: /* + * Only one arg - accept two forms: + * Just load address, or just boot file name. The latter + * form must be written in a format which can not be + * mis-interpreted as a valid number. */ - if (argv[1][0] == '"') { /* just boot filename */ - copy_filename (BootFile, argv[1], sizeof(BootFile)); - } else { /* load address */ - load_addr = simple_strtoul(argv[1], NULL, 16); - } + addr = simple_strtoul(argv[1], &end, 16); + if (end == (argv[1] + strlen(argv[1]))) + load_addr = addr; + else + copy_filename(BootFile, argv[1], sizeof(BootFile)); break; case 3: load_addr = simple_strtoul(argv[1], NULL, 16); |