From d48814273a50cf0b293148cc40a6a5cc7c13686e Mon Sep 17 00:00:00 2001 From: Steven Roberts Date: Tue, 16 Jul 2019 11:40:46 -0700 Subject: [PATCH] gpg-interface: do not scan past the end of buffer Signed-off-by: Steven Roberts --- gpg-interface.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gpg-interface.c b/gpg-interface.c index 8ed274533f..775475131d 100644 --- a/gpg-interface.c +++ b/gpg-interface.c @@ -116,6 +116,11 @@ static void parse_gpg_output(struct signature_check *sigc) for (line = buf; *line; line = strchrnul(line+1, '\n')) { while (*line == '\n') line++; + + /* Break out of trailing '\n' */ + if (!*line) + break; + /* Skip lines that don't start with GNUPG status */ if (!skip_prefix(line, "[GNUPG:] ", &line)) continue; -- 2.21.0