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>
Steven Roberts committed
Jul 16, 2019 at 11:47 UTC
64c45dc72ef039215f23d1b8f077dd6f9f254d38
1 file changed
+3
gpg-interface.c
+3
@@ -116,6 +116,9 @@ static void parse_gpg_output(struct signature_check *sigc)
116
for (line = buf; *line; line = strchrnul(line+1, '\n')) {
117
while (*line == '\n')
118
line++;
119
+ if (!*line)
120
+ break;
121
+
122
/* Skip lines that don't start with GNUPG status */
123
if (!skip_prefix(line, "[GNUPG:] ", &line))
124
continue;