{ .key = "escape", .value = "'hello' \"world\"", },
{ .key = "first", .value = "bobby" },
{ .key = "nasty", .value = "\';-- SELECT * FROM bobby.tables" },
+ { .key = "feisty", .value = "' OR '1'='1" },
VAR_EXPAND_TABLE_END
};
{ .in = "%{literal(\"\\\"\\\\hello\\\\world\\\"\")}", .out = "'\"\\hello\\world\"'", .ret = 0 },
/* Unsupported escape sequence */
{ .in = "%{literal('\\z')}", .out = "Invalid character escape", .ret = -1 },
+
+ /* safe filter */
+ { .in = "%{feisty}", "'\\' OR \\'1\\'=\\'1'", .ret = 0 },
+ { .in = "%{clean|safe} and %{feisty}", "hello world and '\\' OR \\'1\\'=\\'1'", .ret = 0 },
};
const struct var_expand_params params = {
void var_expand_state_unset_transfer(struct var_expand_state *state)
{
str_truncate(state->transfer, 0);
+ state->transfer_safe = FALSE;
state->transfer_set = FALSE;
}