1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-13 16:56:08 +02:00

gpg-interface: do not scan past the end of buffer

If the GPG output ends with trailing blank lines, after skipping
them over inside the loop to find the terminating NUL at the end,
the loop ends up looking for the next line, starting past the end.

Signed-off-by: Steven Roberts <sroberts@fenderq.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Steven Roberts 2019-07-16 11:47:37 -07:00 committed by Junio C Hamano
parent 0d0ac3826a
commit 64c45dc72e

View File

@ -116,6 +116,9 @@ static void parse_gpg_output(struct signature_check *sigc)
for (line = buf; *line; line = strchrnul(line+1, '\n')) {
while (*line == '\n')
line++;
if (!*line)
break;
/* Skip lines that don't start with GNUPG status */
if (!skip_prefix(line, "[GNUPG:] ", &line))
continue;