Welcome! Log In Create A New Profile

Advanced

[PATCH 1/2] BUG/MEDIUM: cli: Prevent double free in CLI ACL lookup

Posted by Nenad Merdanovic 
The memory is released by cli_release_mlook, which also properly sets the
pointer to NULL. This was introduced with a big code reorganization
involving moving to the new keyword registration form in commit ad8be61c7.

This fix needs to be backported to 1.7.

Signed-off-by: Nenad Merdanovic <[email protected]>
---
src/map.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/src/map.c b/src/map.c
index b6fce4d..90deb08 100644
--- a/src/map.c
+++ b/src/map.c
@@ -524,7 +524,6 @@ static int cli_io_handler_map_lookup(struct appctx *appctx)

default:
appctx->st2 = STAT_ST_FIN;
- free(appctx->ctx.map.chunk.str);
return 1;
}
}
--
2.9.3
Nenad Merdanovic
[PATCH 2/2] BUG/MINOR: Fix "get map <map> <value>" CLI command
March 12, 2017 10:10PM
The said form of the CLI command didn't return anything since commit
ad8be61c7.

This fix needs to be backported to 1.7.

Signed-off-by: Nenad Merdanovic <[email protected]>
---
src/map.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/map.c b/src/map.c
index 90deb08..e8c6a2a 100644
--- a/src/map.c
+++ b/src/map.c
@@ -906,7 +906,7 @@ static struct cli_kw_list cli_kws = {{ },{
{ { "add", "map", NULL }, "add map : add map entry", cli_parse_add_map, NULL },
{ { "clear", "map", NULL }, "clear map <id> : clear the content of this map", cli_parse_clear_map, NULL },
{ { "del", "map", NULL }, "del map : delete map entry", cli_parse_del_map, NULL },
- { { "get", "map", NULL }, "get map : report the keys and values matching a sample for a map", cli_parse_get_map, NULL },
+ { { "get", "map", NULL }, "get map : report the keys and values matching a sample for a map", cli_parse_get_map, cli_io_handler_map_lookup, cli_release_mlook },
{ { "set", "map", NULL }, "set map : modify map entry", cli_parse_set_map, NULL },
{ { "show", "map", NULL }, "show map [id] : report available maps or dump a map's contents", cli_parse_show_map, NULL },
{ { NULL }, NULL, NULL, NULL }
--
2.9.3
Series applied, thanks Nenad,

Willy
Sorry, only registered users may post in this forum.

Click here to login