Skip to content

Commit cf074a9

Browse files
phillipwoodgitster
authored andcommitted
diff --color-moved-ws: fix out of bounds string access
When adjusting the start of the string to take account of the change in indentation the code was not checking that the string being adjusted was in fact longer than the indentation change. This was detected by asan. Signed-off-by: Phillip Wood <[email protected]> Reviewed-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 74d156f commit cf074a9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diff.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ static int cmp_in_block_with_wsd(const struct diff_options *o,
865865
al -= wslen;
866866
}
867867

868-
if (strcmp(a, c))
868+
if (al != cl || memcmp(a, c, al))
869869
return 1;
870870

871871
return 0;

0 commit comments

Comments
 (0)