parser_bison: memleak symbol redefinition
Pablo Neira Ayuso
maintainerPATCH 1/3 parser_bison: memleak symbol redefinition
Missing expr_free() from the error path.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/parser_bison.y | 1 + 1 file changed, 1 insertion(+)
src/parser_bison.y +1 -0
@@ -862,6 +862,7 @@ common_block : INCLUDE QUOTED_STRING stmt_separator if (symbol_lookup(scope, $2) != NULL) { erec_queue(error(&@2, "redefinition of symbol '%s'", $2), state->msgs); + expr_free($4); xfree($2); YYERROR; }
Signature · 1 line
2.20.1
Pablo Neira Ayuso
maintainerPATCH 2/3 evaluate: memleak in invalid default policy definition
Release the clone expression from the exit path.
Fixes 5173151863d3 ("evaluate: replace variable expression by the value expression")
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/evaluate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
src/evaluate.c +3 -1
@@ -2017,8 +2017,10 @@ static int expr_evaluate_variable(struct eval_ctx *ctx, struct expr **exprp) {struct expr *new =expr_clone ((*exprp)->sym->expr); -if (expr_evaluate (ctx, &new) <0 ) +if (expr_evaluate (ctx, &new) <0 ) { +expr_free (new);return -1 ; + }expr_free (*exprp); *exprp = new;
Signature · 1 line
2.20.1
Pablo Neira Ayuso
maintainerPATCH 3/3 evaluate: UAF in hook priority expression
In reply to Pablo Neira AyusoRelease priority expression right before assigning the constant expression that results from the evaluation.
Fixes 627c451b2351 ("src: allow variables in the chain priority specification")
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/evaluate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
src/evaluate.c +1 -1
@@ -3707,7 +3707,6 @@ static bool evaluate_priority(struct eval_ctx *ctx, struct prio_spec *prio,mpz_export_data (prio_str, prio->expr->value,BYTEORDER_HOST_ENDIAN ,NFT_NAME_MAXLEN ); loc = prio->expr->location; -expr_free (prio->expr);if (sscanf (prio_str,"%s %c %d" , prio_fst, &op, &prio_snd) <3 ) { priority =std_prio_lookup (prio_str, family, hook);
@@ -3724,6 +3723,7 @@ static bool evaluate_priority(struct eval_ctx *ctx, struct prio_spec *prio,else return false; } +expr_free (prio->expr); prio->expr = constant_expr_alloc(&loc, &integer_type, BYTEORDER_HOST_ENDIAN, sizeof(int) * BITS_PER_BYTE,
Signature · 1 line
2.20.1