net: Fix arguments in tftpput command
PATCH v2 1/1 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.
---
Changes in v2:
- Check return value and print friendly message if incorrect
common/cmd_net.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
common/cmd_net.c +5 -2
@@ -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
Signature · 1 line
1.7.3.1
Wolfgang Denk
AppliedPATCH v2 1/1 net: Fix arguments in tftpput command
Dear Simon Glass,
Quoted 8 lines · In message <[email protected]> you wrote:
The switch to
strict_strtoul()was not done correctly - this fixes the compile error whenCONFIG_CMD_TFTPPUTis active.There appears to very little use of
strict_strtoul()in commands, so it might be easier to switch tosimple_strtoul(). If not, we should decide the best way to usestrict_strtoul(). For now I have added a friendly message which will of course increase code size.
Quoted 7 lines
Signed-off-by Simon Glass <[email protected]>---
Changes in v2:
- Check return value and print friendly message if incorrectcommon/cmd_net.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Here's a fish hangs in the net like a poor man's right in the law. 'Twill hardly come out." - Shakespeare, Pericles, Act II, Scene 1