From: Scott Kostyshak Date: Sun, 18 Aug 2019 17:07:26 +0000 (-0400) Subject: Fix parsing of GnuPG output X-Git-Tag: 2019-10-25~99 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5fd62eb1b4aa637868ee2d513ead3a3dfca7284;p=neomutt Fix parsing of GnuPG output 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. --- diff --git a/ncrypt/pgp.c b/ncrypt/pgp.c index be98a6c1c..0019d21ec 100644 --- a/ncrypt/pgp.c +++ b/ncrypt/pgp.c @@ -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;