summaryrefslogtreecommitdiff
path: root/contrib/examples/git-merge.sh
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2017-11-11 15:10:19 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-11-12 14:41:40 +0900
commit6ce15ce576afb0510e9d6189ff3780369fdc5b2b (patch)
tree6f3b03ea6f514b7fc2130e0860d1880cd30c763d /contrib/examples/git-merge.sh
parentGit 2.11.4 (diff)
downloadtgif-6ce15ce576afb0510e9d6189ff3780369fdc5b2b.tar.xz
apply: avoid out-of-bounds access in fuzzy_matchlines()
fuzzy_matchlines() uses a pointers to the first and last characters of two lines to keep track while matching them. This makes it impossible to deal with empty strings. It accesses characters before the start of empty lines. It can also access characters after the end when checking for trailing whitespace in the main loop. Avoid that by using pointers to the first character and the one *after* the last one. This is well-defined as long as the latter is not dereferenced. Basically rewrite the function based on that premise; it becomes much simpler as a result. There is no need to check for leading whitespace outside of the main loop anymore. Reported-by: Mahmoud Al-Qudsi <mqudsi@neosmart.net> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/examples/git-merge.sh')
0 files changed, 0 insertions, 0 deletions