Message ID | 20230615082650.2693630-1-pro@denx.de |
---|---|
State | Changes Requested |
Delegated to: | Stefano Babic |
Headers | show |
Series | [libubootenv,1/2] validate_flags: Bugfix for TYPE_ATTR_HEX | expand |
Hi Philip, On 15.06.23 10:26, Philip Oberfichtner wrote: > value should start with the '0' character, corresponding to 0x30. Before > this patch we checked for 0x00 instead. > > Signed-off-by: Philip Oberfichtner <pro@denx.de> > --- > src/uboot_env.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/uboot_env.c b/src/uboot_env.c > index 3320753..a31e459 100644 > --- a/src/uboot_env.c > +++ b/src/uboot_env.c > @@ -1711,7 +1711,7 @@ static bool libuboot_validate_flags(struct var_entry *entry, const char *value) > case TYPE_ATTR_DECIMAL: > case TYPE_ATTR_HEX: > errno = 0; > - ok_type = strlen(value) > 2 && (value[0] == 0) && > + ok_type = strlen(value) > 2 && (value[0] == '0') && This is of course a bug, thanks for catching and fixing. Reviewed-by: Stefano Babic <sbabic@denx.de> Best regards, Stefano Babic > (value[1] == 'x' || value [1] == 'X'); > if (ok_type) { > test = strtoull(value, NULL, 16);
diff --git a/src/uboot_env.c b/src/uboot_env.c index 3320753..a31e459 100644 --- a/src/uboot_env.c +++ b/src/uboot_env.c @@ -1711,7 +1711,7 @@ static bool libuboot_validate_flags(struct var_entry *entry, const char *value) case TYPE_ATTR_DECIMAL: case TYPE_ATTR_HEX: errno = 0; - ok_type = strlen(value) > 2 && (value[0] == 0) && + ok_type = strlen(value) > 2 && (value[0] == '0') && (value[1] == 'x' || value [1] == 'X'); if (ok_type) { test = strtoull(value, NULL, 16);
value should start with the '0' character, corresponding to 0x30. Before this patch we checked for 0x00 instead. Signed-off-by: Philip Oberfichtner <pro@denx.de> --- src/uboot_env.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)