summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorAndreas Fenkart <andreas.fenkart@digitalstrom.com>2015-12-09 13:13:21 +0100
committerTom Rini <trini@konsulko.com>2016-02-08 10:10:29 -0500
commit167f52587173ad87aac7780058d59aa96422eed0 (patch)
treed39de91480d87b075fec417430042ffff6be2823 /common
parent57dc53a72460e8e301fa1cc7951b41db8e731485 (diff)
downloadu-boot-imx-167f52587173ad87aac7780058d59aa96422eed0.zip
u-boot-imx-167f52587173ad87aac7780058d59aa96422eed0.tar.gz
u-boot-imx-167f52587173ad87aac7780058d59aa96422eed0.tar.bz2
tools: env validate: pass values as 0-based array
passing argv/argc can produce off-by-one errors Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
Diffstat (limited to 'common')
-rw-r--r--common/env_flags.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/common/env_flags.c b/common/env_flags.c
index 9c3aed1..735bba5 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -373,21 +373,21 @@ int env_flags_validate_varaccess(const char *name, int check_mask)
/*
* Validate the parameters to "env set" directly
*/
-int env_flags_validate_env_set_params(int argc, char * const argv[])
+int env_flags_validate_env_set_params(char *name, char * const val[], int count)
{
- if ((argc >= 3) && argv[2] != NULL) {
- enum env_flags_vartype type = env_flags_get_type(argv[1]);
+ if ((count >= 1) && val[0] != NULL) {
+ enum env_flags_vartype type = env_flags_get_type(name);
/*
* we don't currently check types that need more than
* one argument
*/
- if (type != env_flags_vartype_string && argc > 3) {
- printf("## Error: too many parameters for setting "
- "\"%s\"\n", argv[1]);
+ if (type != env_flags_vartype_string && count > 1) {
+ printf("## Error: too many parameters for setting \"%s\"\n",
+ name);
return -1;
}
- return env_flags_validate_type(argv[1], argv[2]);
+ return env_flags_validate_type(name, val[0]);
}
/* ok */
return 0;