Skip to content

Commit 64c45dc

Browse files
Steven Robertsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d0ac38 commit 64c45dc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

gpg-interface.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ static void parse_gpg_output(struct signature_check *sigc)
116116
for (line = buf; *line; line = strchrnul(line+1, '\n')) {
117117
while (*line == '\n')
118118
line++;
119+
if (!*line)
120+
break;
121+
119122
/* Skip lines that don't start with GNUPG status */
120123
if (!skip_prefix(line, "[GNUPG:] ", &line))
121124
continue;

0 commit comments

Comments
 (0)