summaryrefslogtreecommitdiff
path: root/apply.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-07-12 15:18:22 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-07-12 15:18:22 -0700
commit6fee4ca6255ad5ffe3be98c11e7822166e2d4510 (patch)
treeb475b7357d298162185c1fc213c4773d8ad6ff1f /apply.c
parentMerge branch 'sb/submodule-doc' (diff)
parentapply: use strcmp(3) for comparing strings in gitdiff_verify_name() (diff)
downloadtgif-6fee4ca6255ad5ffe3be98c11e7822166e2d4510.tar.xz
Merge branch 'rs/apply-avoid-over-reading'
Code cleanup. * rs/apply-avoid-over-reading: apply: use strcmp(3) for comparing strings in gitdiff_verify_name()
Diffstat (limited to 'apply.c')
-rw-r--r--apply.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/apply.c b/apply.c
index 4050cebcfa..f2d599141d 100644
--- a/apply.c
+++ b/apply.c
@@ -962,13 +962,12 @@ static int gitdiff_verify_name(struct apply_state *state,
}
if (*name) {
- int len = strlen(*name);
char *another;
if (isnull)
return error(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"),
*name, state->linenr);
another = find_name(state, line, NULL, state->p_value, TERM_TAB);
- if (!another || memcmp(another, *name, len + 1)) {
+ if (!another || strcmp(another, *name)) {
free(another);
return error((side == DIFF_NEW_NAME) ?
_("git apply: bad git-diff - inconsistent new filename on line %d") :