Skip to content

Commit 6fee4ca

Browse files
committed
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()
2 parents b5fe65f + 2d10545 commit 6fee4ca

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

apply.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -962,13 +962,12 @@ static int gitdiff_verify_name(struct apply_state *state,
962962
}
963963

964964
if (*name) {
965-
int len = strlen(*name);
966965
char *another;
967966
if (isnull)
968967
return error(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"),
969968
*name, state->linenr);
970969
another = find_name(state, line, NULL, state->p_value, TERM_TAB);
971-
if (!another || memcmp(another, *name, len + 1)) {
970+
if (!another || strcmp(another, *name)) {
972971
free(another);
973972
return error((side == DIFF_NEW_NAME) ?
974973
_("git apply: bad git-diff - inconsistent new filename on line %d") :

0 commit comments

Comments
 (0)