summaryrefslogtreecommitdiff
path: root/builtin/receive-pack.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-03-07 00:59:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-03-07 00:59:57 (GMT)
commit4751a1673c7d4aeb1b6462f89fa7d86c05898d05 (patch)
tree930ba74ef43d0c96462056e00dc80e1ec5f11eff /builtin/receive-pack.c
parentc388c12c927dc42b1b8eb2368d3519a846483081 (diff)
parent9903623761e6882a1c885ca4245dd6951052ecc3 (diff)
downloadgit-4751a1673c7d4aeb1b6462f89fa7d86c05898d05.zip
git-4751a1673c7d4aeb1b6462f89fa7d86c05898d05.tar.gz
git-4751a1673c7d4aeb1b6462f89fa7d86c05898d05.tar.bz2
Merge branch 'ab/receive-pack-use-after-free-fix'
Memfix. * ab/receive-pack-use-after-free-fix: receive-pack: fix use-after-free bug
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 8bc714a..29f165d 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -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;