]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/blame.c
blame: prefer xsnprintf to strcpy for colors
authorJeff King <peff@peff.net>
Fri, 13 Jul 2018 20:43:50 +0000 (16:43 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Jul 2018 20:59:39 +0000 (13:59 -0700)
commit022d2ac1f3f89f5af1e712f72bfc69c716d64926
treeeebe147e971a2617ccc5c5f420a6a79d936ac4b6
parent297bdf0791540fb3e98676a59828dd8a331d6615
blame: prefer xsnprintf to strcpy for colors

Our color buffers are all COLOR_MAXLEN, which fits the
largest possible color. So we can never overflow the buffer
by copying an existing color. However, using strcpy() makes
it harder to audit the code-base for calls that _are_
problems. We should use something like xsnprintf(), which
shows the reader that we expect this never to fail (and
provides a run-time assertion if it does, just in case).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/blame.c