]> granicus.if.org Git - neomutt/commitdiff
Fix parsing of GnuPG output
authorScott Kostyshak <scott.kostyshak@gmail.com>
Sun, 18 Aug 2019 17:07:26 +0000 (13:07 -0400)
committerRichard Russon <rich@flatcap.org>
Sun, 18 Aug 2019 18:58:00 +0000 (19:58 +0100)
In GnuPG output there is a space after "[GNUPG:]". If the space is
not taken into account, the rest of the parsing fails, e.g., because
the variable "line" starts with " BEGIN_DECRYPTION" instead of the
expected "BEGIN_DECRYPTION".

This commit restores the previous parsing functionality. It appears
that the number of spaces does not differ among GnuPG versions.
However, if we wanted to make the code robust to varying amount of
space following "[GNUPG:]", we could either trim the whitespace from
the beginning or take it into account with mutt_str_lws_len().

This commit fixes a regression introduced at c2aa0c06.

ncrypt/pgp.c

index be98a6c1ca06cdb61b22c868277bfc28394c75e3..0019d21ecadf84b598f9fb5e241c7c1dc3b00fdd 100644 (file)
@@ -363,7 +363,7 @@ static int pgp_check_decryption_okay(FILE *fp_in)
 
   while ((line = mutt_file_read_line(line, &linelen, fp_in, &lineno, 0)))
   {
-    size_t plen = mutt_str_startswith(line, "[GNUPG:]", CASE_MATCH);
+    size_t plen = mutt_str_startswith(line, "[GNUPG:] ", CASE_MATCH);
     if (plen == 0)
       continue;
     s = line + plen;