]> git.ipfire.org Git - thirdparty/git.git/commit - range-diff.c
range-diff: avoid negative string precision
authorVasil Dimov <vd@FreeBSD.org>
Wed, 15 Apr 2020 20:32:25 +0000 (20:32 +0000)
committerJunio C Hamano <gitster@pobox.com>
Thu, 16 Apr 2020 01:32:48 +0000 (18:32 -0700)
commit8d1675eb7f7f76af834c72e72c8824410e874fec
tree25a2bf401bf645c83fd775c08c67433d0033bb7a
parent8cf51561d1e15e8f5ad907df00884a7596737dcd
range-diff: avoid negative string precision

If the supplied integer for "precision" is negative in
`"%.*s", len, line` then it is ignored. So the current code is
equivalent to just `"%s", line` because it is executed only if
`len` is negative.

Fix this by saving the value of `len` before overwriting it with the
return value of `parse_git_diff_header()`.

Signed-off-by: Vasil Dimov <vd@FreeBSD.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
range-diff.c