diff: avoid stack-buffer-read-overrun for very long name
authorJim Meyering <jim@meyering.net>
Mon, 16 Apr 2012 15:20:02 +0000 (17:20 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 16 Apr 2012 17:10:25 +0000 (10:10 -0700)
commit48e510b6a29b1066016cbbee75c0b196174a88d4
treefe568b4ff1151c6f067383bf4594df728d45ea6c
parent6eab5f2f14806cf6a7b665d96766a59c13a41f4b
diff: avoid stack-buffer-read-overrun for very long name

Due to the use of strncpy without explicit NUL termination,
we could end up passing names n1 or n2 that are not NUL-terminated
to queue_diff, which requires NUL-terminated strings.
Ensure that each is NUL terminated.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff-no-index.c