Commit 4751a167 authored by Junio C Hamano's avatar Junio C Hamano

Merge branch 'ab/receive-pack-use-after-free-fix'

Memfix.

* ab/receive-pack-use-after-free-fix:
  receive-pack: fix use-after-free bug
parents c388c12c 99036237
......@@ -1202,17 +1202,12 @@ static void run_update_post_hook(struct command *commands)
}
}
static void check_aliased_update(struct command *cmd, struct string_list *list)
static void check_aliased_update_internal(struct command *cmd,
struct string_list *list,
const char *dst_name, int flag)
{
struct strbuf buf = STRBUF_INIT;
const char *dst_name;
struct string_list_item *item;
struct command *dst_cmd;
int flag;
strbuf_addf(&buf, "%s%s", get_git_namespace(), cmd->ref_name);
dst_name = resolve_ref_unsafe(buf.buf, 0, NULL, &flag);
strbuf_release(&buf);
if (!(flag & REF_ISSYMREF))
return;
......@@ -1251,6 +1246,18 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)
"inconsistent aliased update";
}
static void check_aliased_update(struct command *cmd, struct string_list *list)
{
struct strbuf buf = STRBUF_INIT;
const char *dst_name;
int flag;
strbuf_addf(&buf, "%s%s", get_git_namespace(), cmd->ref_name);
dst_name = resolve_ref_unsafe(buf.buf, 0, NULL, &flag);
check_aliased_update_internal(cmd, list, dst_name, flag);
strbuf_release(&buf);
}
static void check_aliased_updates(struct command *commands)
{
struct command *cmd;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment