summaryrefslogtreecommitdiffstats
path: root/cmd/nvedit.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/nvedit.c')
-rw-r--r--cmd/nvedit.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index d188c6aa6b..7fce723800 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -1171,6 +1171,11 @@ static int do_env_import(struct cmd_tbl *cmdtp, int flag,
uint32_t crc;
env_t *ep = (env_t *)ptr;
+ if (size <= offsetof(env_t, data)) {
+ printf("## Error: Invalid size 0x%zX\n", size);
+ return 1;
+ }
+
size -= offsetof(env_t, data);
memcpy(&crc, &ep->crc, sizeof(crc));
@@ -1472,7 +1477,7 @@ static char env_help_text[] =
"env select [target] - select environment target\n"
#endif
#if defined(CONFIG_CMD_NVEDIT_EFI)
- "env set -e [-nv][-bs][-rt][-at][-a][-i addr,size][-v] name [arg ...]\n"
+ "env set -e [-nv][-bs][-rt][-at][-a][-i addr:size][-v] name [arg ...]\n"
" - set UEFI variable; unset if '-i' or 'arg' not specified\n"
#endif
"env set [-f] name [arg ...]\n";
@@ -1536,7 +1541,7 @@ U_BOOT_CMD_COMPLETE(
"set environment variables",
#if defined(CONFIG_CMD_NVEDIT_EFI)
"-e [-guid guid][-nv][-bs][-rt][-at][-a][-v]\n"
- " [-i addr,size name], or [name [value ...]]\n"
+ " [-i addr:size name], or [name [value ...]]\n"
" - set UEFI variable 'name' to 'value' ...'\n"
" \"-guid\": GUID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n"
" \"-nv\": set non-volatile attribute\n"