diff --git a/cmd/nvedit.c b/cmd/nvedit.c index 793b68b887..de16c72c23 100644 --- a/cmd/nvedit.c +++ b/cmd/nvedit.c @@ -987,7 +987,8 @@ NXTARG: ; } if (chk) { - envp->crc = crc32(0, envp->data, ENV_SIZE); + envp->crc = crc32(0, envp->data, + size ? size - offsetof(env_t, data) : ENV_SIZE); #ifdef CONFIG_ENV_ADDR_REDUND envp->flags = ACTIVE_FLAG; #endif