summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-10-19 10:48:29 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-19 10:48:29 -0700
commitc31b87d111f6df359255979ea94e8648a51c3647 (patch)
tree0c3d2f5db3864192f435795c7ba41d85d30878b5 /builtin
parentMerge branch 'jk/config-test-cleanup' (diff)
parentfix "git apply --index ..." not to deref NULL (diff)
downloadtgif-c31b87d111f6df359255979ea94e8648a51c3647.tar.xz
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')
-rw-r--r--builtin/apply.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 694f55dc5a..84a8a0b521 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;