Skip to contentSkip to conversation

lib/tst_kconfig: Fix off-by-one in string check

PATCH New Cyril Hrubis 1 participant 1 message Nov 19, 2020 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/tst_kconfig: Fix off-by-one in string check

Fixed the condition for "Garbage after string" that was previously triggered on a correct strings.

Fixes eeed458492cc ("lib/tst_kconfig: Validate variables")
---
 lib/tst_kconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/tst_kconfig.c +1 -1
index 35f20e7a4..734039e37 100644
@@ -291,7 +291,7 @@ static int validate_var(const struct tst_expr_tok *var)
 			i++;
 		} while (i < var->tok_len && var->tok[i] != '"');
 
-		if (i < var->tok_len) {
+		if (i < var->tok_len - 1) {
 			print_err(stderr, var, i, "Garbage after a string");
 			return 1;
 		}
Signature · 1 line
2.26.2