diff mbox series

[libubootenv,v2,1/2] validate_flags: Bugfix for TYPE_ATTR_HEX

Message ID 20230615130854.2700871-1-pro@denx.de
State Accepted
Delegated to: Stefano Babic
Headers show
Series [libubootenv,v2,1/2] validate_flags: Bugfix for TYPE_ATTR_HEX | expand

Commit Message

Philip Oberfichtner June 15, 2023, 1:08 p.m. UTC
value should start with the '0' character, corresponding to 0x30. Before
this patch we checked for 0x00 instead.

Reviewed-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Philip Oberfichtner <pro@denx.de>
---

Changes in v2: Reviewed by Stefano

 src/uboot_env.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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);