common/cmd_nvedit.c: Fix size calculation in do_env_import()
PATCH 1/1 common/cmd_nvedit.c: Fix size calculation in do_env_import()
do_env_import() missed the final '\0' terminator when calculating the size of an environment data block. This led to an erroneous 'bad CRC, import failed' message for a checksum protected environment (-c.)
--- common/cmd_nvedit.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
common/cmd_nvedit.c +1 -1
@@ -868,7 +868,7 @@ static int do_env_import(cmd_tbl_t *cmdtp, int flag,printf ("## Warning: Input data exceeds %d bytes" " - truncated\n" ,MAX_ENV_SIZE ); } - ++size; + size +=2 ;printf ("## Info: input data size = %zu = 0x%zX\n" , size, size); }
Signature · 1 line
1.7.7.4
PATCH 1/1 common/cmd_nvedit.c: Fix size calculation in do_env_import()
Dear Horst Kronstorfer,
Quoted 3 lines · In message <[email protected]> you…
do_env_import()missed the final '\0' terminator when calculating the size of an environment data block. This led to an erroneous 'bad CRC, import failed' message for a checksum protected environment (-c.)
Can you please describe a test case that shows this bug?
Thanks.
Best regards,
Wolfgang Denk
Signature · 4 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 God made the integers; all else is the work of Man. - Kronecker
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 common/cmd_nvedit.c: Fix size calculation in do_env_import()
Dear KRONSTORFER Horst,
Quoted 7 lines · In message <[email protected]>…
Quoted 2 lines
Can you please describe a test case that shows this bug?
host:
echo foo=bar > env.txt
mkenvimage -b -s 13 -o env.bin env.txt
Quoted 5 lines
be target:
tftp 200000 env.bin
env import -c $fileaddr
## Info: input data size = 12 =0xC
## Error: bad CRC, import failed
Thanks.
[Note: it would have been even more helpful if you had also provided a hex dump of "env.bin" - as is, it's difficult for me to see if there is a bug with cmd_nvedit or with your version of the mkenvimage tool.]
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 Q: Why do PCs have a reset button on the front? A: Because they are expected to run Microsoft operating systems.
Wolfgang Denk
AppliedPATCH 1/1 common/cmd_nvedit.c: Fix size calculation in do_env_import()
In reply to Horst KronstorferDear Horst Kronstorfer,
Quoted 8 lines · In message <[email protected]> you…
do_env_import()missed the final '\0' terminator when calculating the size of an environment data block. This led to an erroneous 'bad CRC, import failed' message for a checksum protected environment (-c.)Signed-off-by Horst Kronstorfer <[email protected]>--- common/cmd_nvedit.c | 2 +- 1 files changed, 1 insertions(+), 1 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 You don't have to stay up nights to succeed; you have to stay awake days.