summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Roberts <fenderq@gmail.com>2019-07-16 18:47:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-07-16 19:15:12 (GMT)
commit64c45dc72ef039215f23d1b8f077dd6f9f254d38 (patch)
treeb74e18fb889fd283491f42b2ba94964250f2a562
parent0d0ac3826a3bbb9247e39e12623bbcfdd722f24c (diff)
downloadgit-64c45dc72ef039215f23d1b8f077dd6f9f254d38.zip
git-64c45dc72ef039215f23d1b8f077dd6f9f254d38.tar.gz
git-64c45dc72ef039215f23d1b8f077dd6f9f254d38.tar.bz2
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>
-rw-r--r--gpg-interface.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gpg-interface.c b/gpg-interface.c
index 8ed2745..d60115c 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -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;