summaryrefslogtreecommitdiff
path: root/builtin/apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-10-19 17:48:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-10-19 17:48:29 (GMT)
commitc31b87d111f6df359255979ea94e8648a51c3647 (patch)
tree0c3d2f5db3864192f435795c7ba41d85d30878b5 /builtin/apply.c
parente283548b85791fad6752e03cc15c6271b80c5fae (diff)
parent2c93286ab2ca5271e26779ffd1ecfd1c7a082a41 (diff)
downloadgit-c31b87d111f6df359255979ea94e8648a51c3647.zip
git-c31b87d111f6df359255979ea94e8648a51c3647.tar.gz
git-c31b87d111f6df359255979ea94e8648a51c3647.tar.bz2
Merge branch 'jm/maint-apply-detects-corrupt-patch-header'
* jm/maint-apply-detects-corrupt-patch-header: fix "git apply --index ..." not to deref NULL
Diffstat (limited to 'builtin/apply.c')
-rw-r--r--builtin/apply.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 694f55d..84a8a0b 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1407,6 +1407,9 @@ static int find_header(char *line, unsigned long size, int *hdrsize, struct patc
"%d leading pathname components (line %d)" , p_value, linenr);
patch->old_name = patch->new_name = patch->def_name;
}
+ if (!patch->is_delete && !patch->new_name)
+ die("git diff header lacks filename information "
+ "(line %d)", linenr);
patch->is_toplevel_relative = 1;
*hdrsize = git_hdr_len;
return offset;