aboutsummaryrefslogtreecommitdiff
path: root/apply.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-07-12 15:18:22 -0700
committerJunio C Hamano <gitster@pobox.com>2017-07-12 15:18:22 -0700
commit6fee4ca6255ad5ffe3be98c11e7822166e2d4510 (patch)
treeb475b7357d298162185c1fc213c4773d8ad6ff1f /apply.c
parentb5fe65fe93db1931501027a322ecb6a9f17f56e7 (diff)
parent2d105451c0768fc3e9600dec7bca2376f482521e (diff)
downloadgit-6fee4ca6255ad5ffe3be98c11e7822166e2d4510.tar.gz
git-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 4050cebcf..f2d599141 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") :