Commit 38bd80b4856254916e886488f8e455e3bc15fdbe

Authored by Simon Glass
Committed by Wolfgang Denk
1 parent bf0b631343

net: Fix arguments in tftpput command

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>

Showing 1 changed file with 5 additions and 2 deletions Side-by-side Diff

... ... @@ -221,8 +221,11 @@
221 221  
222 222 #ifdef CONFIG_CMD_TFTPPUT
223 223 case 4:
224   - save_addr = strict_strtoul(argv[1], NULL, 16);
225   - save_size = strict_strtoul(argv[2], NULL, 16);
  224 + if (strict_strtoul(argv[1], 16, &save_addr) < 0 ||
  225 + strict_strtoul(argv[2], 16, &save_size) < 0) {
  226 + printf("Invalid address/size\n");
  227 + return cmd_usage(cmdtp);
  228 + }
226 229 copy_filename(BootFile, argv[3], sizeof(BootFile));
227 230 break;
228 231 #endif