Skip to contentSkip to conversation

lib/tst_bool_expr: Clear priv pointer on token insertion

PATCH New Cyril Hrubis 1 participant 1 message Jul 13, 2021 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lib/tst_bool_expr: Clear priv pointer on token insertion

We are using the priv pointer to store an error message but as it wasn't initialized from the start it may have contianed random data leading to a crash on a parser error reports.

---
 lib/tst_bool_expr.c | 1 +
 1 file changed, 1 insertion(+)
lib/tst_bool_expr.c +1 -0
index 387c38b91..15825e364 100644
@@ -55,6 +55,7 @@ static int new_tok(struct tst_expr_tok **last, const char *tok, size_t tok_len)
 	(*last)->tok = tok;
 	(*last)->tok_len = tok_len;
 	(*last)->op = char_to_op(tok[0]);
+	(*last)->priv = NULL;
 	(*last)++;
 
 	return 1;
Signature · 1 line
2.31.1