Message ID | 1324114390-27290-1-git-send-email-hkronsto@frequentis.com |
---|---|
State | Accepted |
Headers | show |
Dear Horst Kronstorfer, In message <1324114390-27290-1-git-send-email-hkronsto@frequentis.com> you wrote: > 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
Dear KRONSTORFER Horst, In message <024FE3275EF7814D9B07390F28C0832C63A20CBC@vie196nt.frequentis.frq> you wrote: > > > 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 > > 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
Dear Horst Kronstorfer, In message <1324114390-27290-1-git-send-email-hkronsto@frequentis.com> you wrote: > 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 <hkronsto@frequentis.com> > --- > common/cmd_nvedit.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) Applied, thanks. Best regards, Wolfgang Denk
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index baaa513..63afc82 100644 --- a/common/cmd_nvedit.c +++ b/common/cmd_nvedit.c @@ -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); }
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 <hkronsto@frequentis.com> --- common/cmd_nvedit.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)