]> git.sur5r.net Git - u-boot/commitdiff
net: Fix arguments in tftpput command
authorSimon Glass <sjg@chromium.org>
Mon, 19 Dec 2011 16:10:43 +0000 (16:10 +0000)
committerWolfgang Denk <wd@denx.de>
Tue, 20 Dec 2011 22:12:32 +0000 (23:12 +0100)
The switch to strict_strtoul() was not done correctly - this fixes
the compile error when CONFIG_CMD_TFTPPUT is active.

There appears to very little use of strict_strtoul() in commands, so
it might be easier to switch to simple_strtoul(). If not, we should
decide the best way to use strict_strtoul(). For now I have added a
friendly message which will of course increase code size.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/cmd_net.c

index f89a24bfd4f6568e07eb8aa0bdb556d1537a2602..89519faad3b04a451ee7c441e857d8398b0aa017 100644 (file)
@@ -221,8 +221,11 @@ static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
 
 #ifdef CONFIG_CMD_TFTPPUT
        case 4:
-               save_addr = strict_strtoul(argv[1], NULL, 16);
-               save_size = strict_strtoul(argv[2], NULL, 16);
+               if (strict_strtoul(argv[1], 16, &save_addr) < 0 ||
+                       strict_strtoul(argv[2], 16, &save_size) < 0) {
+                       printf("Invalid address/size\n");
+                       return cmd_usage(cmdtp);
+               }
                copy_filename(BootFile, argv[3], sizeof(BootFile));
                break;
 #endif