Skip to content

Commit

Permalink
libsemanage: fix use-after-free in parse_module_store()
Browse files Browse the repository at this point in the history
The passing parameter "arg" of parse_module_store will be freed after
calling. A copy of parameter should be used instead of itself.

Signed-off-by: HuaxinLu <luhuaxin1@foxmail.com>
Acked-by: James Carter <jwcart2@gmail.com>
  • Loading branch information
HuaxinLu authored and bachradsusi committed Jun 18, 2021
1 parent 70b31e7 commit 6bff61c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions libsemanage/src/conf-parse.y
Expand Up @@ -516,12 +516,12 @@ static int parse_module_store(char *arg)
char *s;
current_conf->store_type = SEMANAGE_CON_POLSERV_REMOTE;
if ((s = strchr(arg, ':')) == NULL) {
current_conf->store_path = arg;
current_conf->store_path = strdup(arg);
current_conf->server_port = 4242;
} else {
char *endptr;
*s = '\0';
current_conf->store_path = arg;
current_conf->store_path = strdup(arg);
current_conf->server_port = strtol(s + 1, &endptr, 10);
if (*(s + 1) == '\0' || *endptr != '\0') {
return -2;
Expand Down

0 comments on commit 6bff61c

Please sign in to comment.