2015-01-26 17:35:10 +01:00
|
|
|
---
|
2018-07-05 13:57:50 +02:00
|
|
|
crypt-gpgme.c | 2 +-
|
|
|
|
lib.c | 11 +++++++++++
|
|
|
|
lib.h | 1 +
|
|
|
|
pager.c | 2 +-
|
|
|
|
pgp.c | 24 ++++++++++++------------
|
|
|
|
5 files changed, 26 insertions(+), 14 deletions(-)
|
2015-01-26 17:35:10 +01:00
|
|
|
|
2018-07-05 13:57:50 +02:00
|
|
|
--- crypt-gpgme.c
|
2019-11-14 09:54:32 +01:00
|
|
|
+++ crypt-gpgme.c 2019-11-13 13:46:16.512388398 +0000
|
2020-01-15 07:59:22 +01:00
|
|
|
@@ -2733,7 +2733,7 @@ static void copy_clearsigned (gpgme_data
|
2019-11-14 09:54:32 +01:00
|
|
|
|
2018-07-05 13:57:50 +02:00
|
|
|
if (armor_header)
|
|
|
|
{
|
2019-11-14 09:54:32 +01:00
|
|
|
- if (buf[0] == '\n')
|
|
|
|
+ if (buf[0] == '\n' || (buf[0] == '\r' && buf[1] == '\n'))
|
2018-07-05 13:57:50 +02:00
|
|
|
armor_header = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
--- lib.c
|
2019-11-14 09:54:32 +01:00
|
|
|
+++ lib.c 2019-11-13 13:42:00.245189313 +0000
|
2020-01-15 07:59:22 +01:00
|
|
|
@@ -718,6 +718,17 @@ int mutt_strcmp(const char *a, const cha
|
2013-05-29 12:28:08 +02:00
|
|
|
return strcmp(NONULL(a), NONULL(b));
|
|
|
|
}
|
|
|
|
|
|
|
|
+int mutt_strxcmp(const char *a, const char *b)
|
|
|
|
+{
|
2018-07-05 13:57:50 +02:00
|
|
|
+ const size_t xa = strcspn(NONULL(a), "\r\n");
|
|
|
|
+ const size_t xb = strcspn(NONULL(b), "\r\n");
|
2013-05-29 12:28:08 +02:00
|
|
|
+ if (xb != xa)
|
|
|
|
+ return -1;
|
|
|
|
+ if (!xa)
|
|
|
|
+ return 0;
|
2018-07-05 13:57:50 +02:00
|
|
|
+ return strncmp(NONULL(a), NONULL(b), (size_t)xa);
|
2013-05-29 12:28:08 +02:00
|
|
|
+}
|
|
|
|
+
|
2018-07-05 13:57:50 +02:00
|
|
|
int mutt_strcasecmp(const char *a, const char *b)
|
|
|
|
{
|
|
|
|
return strcasecmp(NONULL(a), NONULL(b));
|
|
|
|
--- lib.h
|
2019-11-14 09:54:32 +01:00
|
|
|
+++ lib.h 2019-11-13 13:47:17.399247662 +0000
|
2020-01-15 07:59:22 +01:00
|
|
|
@@ -200,6 +200,7 @@ int mutt_copy_stream (FILE *, FILE *);
|
2019-11-14 09:54:32 +01:00
|
|
|
int mutt_copy_bytes (FILE *, FILE *, size_t);
|
2018-07-05 13:57:50 +02:00
|
|
|
int mutt_strcasecmp (const char *, const char *);
|
|
|
|
int mutt_strcmp (const char *, const char *);
|
2019-11-14 09:54:32 +01:00
|
|
|
+int mutt_strxcmp (const char *, const char *);
|
2018-07-05 13:57:50 +02:00
|
|
|
int mutt_strncasecmp (const char *, const char *, size_t);
|
|
|
|
int mutt_strncmp (const char *, const char *, size_t);
|
|
|
|
int mutt_strcoll (const char *, const char *);
|
|
|
|
--- pager.c
|
2019-11-14 09:54:32 +01:00
|
|
|
+++ pager.c 2019-11-13 13:48:32.257845120 +0000
|
|
|
|
@@ -826,7 +826,7 @@ resolve_types (char *buf, char *raw, str
|
|
|
|
lineInfo[n].type = MT_COLOR_NORMAL;
|
2018-07-05 13:57:50 +02:00
|
|
|
else if (check_attachment_marker ((char *) raw) == 0)
|
|
|
|
lineInfo[n].type = MT_COLOR_ATTACHMENT;
|
|
|
|
- else if (mutt_strcmp ("-- \n", buf) == 0 || mutt_strcmp ("-- \r\n", buf) == 0)
|
|
|
|
+ else if (mutt_strxcmp ("-- \n", buf) == 0)
|
|
|
|
{
|
|
|
|
i = n + 1;
|
2013-05-29 12:28:08 +02:00
|
|
|
|
2018-07-05 13:57:50 +02:00
|
|
|
--- pgp.c
|
2019-11-14 09:54:32 +01:00
|
|
|
+++ pgp.c 2019-11-13 13:51:06.746954963 +0000
|
2018-07-17 11:51:04 +02:00
|
|
|
@@ -373,7 +373,7 @@ static void pgp_copy_clearsigned (FILE *
|
2015-01-26 17:35:10 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-07-05 13:57:50 +02:00
|
|
|
- if (mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
|
|
|
|
+ if (mutt_strxcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0)
|
2015-01-26 17:35:10 +01:00
|
|
|
break;
|
2019-11-14 09:54:32 +01:00
|
|
|
|
2015-01-26 17:35:10 +01:00
|
|
|
if (armor_header)
|
2020-01-15 07:59:22 +01:00
|
|
|
@@ -446,14 +446,14 @@ int pgp_application_pgp_handler (BODY *m
|
2018-07-17 11:51:04 +02:00
|
|
|
could_not_decrypt = 0;
|
|
|
|
decrypt_okay_rc = 0;
|
2013-05-29 12:28:08 +02:00
|
|
|
|
2018-07-05 13:57:50 +02:00
|
|
|
- if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
|
|
|
|
+ if (mutt_strxcmp ("MESSAGE-----\n", buf + 15) == 0)
|
2013-05-29 12:28:08 +02:00
|
|
|
needpass = 1;
|
2018-07-05 13:57:50 +02:00
|
|
|
- else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
|
|
|
|
+ else if (mutt_strxcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
2018-07-05 13:57:50 +02:00
|
|
|
clearsign = 1;
|
2013-05-29 12:28:08 +02:00
|
|
|
needpass = 0;
|
|
|
|
}
|
2018-07-05 13:57:50 +02:00
|
|
|
- else if (!mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15))
|
|
|
|
+ else if (!mutt_strxcmp ("PUBLIC KEY BLOCK-----\n", buf + 15))
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
|
|
|
needpass = 0;
|
2018-07-05 13:57:50 +02:00
|
|
|
pgp_keyblock = 1;
|
2020-01-15 07:59:22 +01:00
|
|
|
@@ -486,10 +486,10 @@ int pgp_application_pgp_handler (BODY *m
|
2019-11-14 09:54:32 +01:00
|
|
|
|
2018-07-05 13:57:50 +02:00
|
|
|
fputs (buf, tmpfp);
|
2013-05-29 12:28:08 +02:00
|
|
|
|
2018-07-05 13:57:50 +02:00
|
|
|
- if ((needpass && mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0) ||
|
|
|
|
+ if ((needpass && mutt_strxcmp ("-----END PGP MESSAGE-----\n", buf) == 0) ||
|
2019-11-14 09:54:32 +01:00
|
|
|
(!needpass
|
2018-07-05 13:57:50 +02:00
|
|
|
- && (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
|
|
|
|
- || mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",buf) == 0)))
|
|
|
|
+ && (mutt_strxcmp ("-----END PGP SIGNATURE-----\n", buf) == 0
|
|
|
|
+ || mutt_strxcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",buf) == 0)))
|
|
|
|
break;
|
|
|
|
/* remember optional Charset: armor header as defined by RfC4880 */
|
|
|
|
if (mutt_strncmp ("Charset: ", buf, 9) == 0)
|
2020-01-15 07:59:22 +01:00
|
|
|
@@ -751,11 +751,11 @@ static int pgp_check_traditional_one_bod
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
2018-07-05 13:57:50 +02:00
|
|
|
if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0)
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
2018-07-05 13:57:50 +02:00
|
|
|
- if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0)
|
|
|
|
+ if (mutt_strxcmp ("MESSAGE-----\n", buf + 15) == 0)
|
|
|
|
enc = 1;
|
|
|
|
- else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
|
|
|
|
+ else if (mutt_strxcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0)
|
|
|
|
sgn = 1;
|
|
|
|
- else if (mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
|
|
|
|
+ else if (mutt_strxcmp ("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
|
|
|
|
key = 1;
|
2013-05-29 12:28:08 +02:00
|
|
|
}
|
|
|
|
}
|
2020-01-15 07:59:22 +01:00
|
|
|
@@ -1297,9 +1297,9 @@ BODY *pgp_sign_message (BODY *a)
|
2013-05-29 12:28:08 +02:00
|
|
|
*/
|
2018-07-05 13:57:50 +02:00
|
|
|
while (fgets (buffer, sizeof (buffer) - 1, pgpout) != NULL)
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
2018-07-05 13:57:50 +02:00
|
|
|
- if (mutt_strcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
|
|
|
|
+ if (mutt_strxcmp ("-----BEGIN PGP MESSAGE-----\n", buffer) == 0)
|
|
|
|
fputs ("-----BEGIN PGP SIGNATURE-----\n", fp);
|
2013-05-29 12:28:08 +02:00
|
|
|
- else if (mutt_strcmp("-----END PGP MESSAGE-----\n", buffer) == 0)
|
|
|
|
+ else if (mutt_strxcmp("-----END PGP MESSAGE-----\n", buffer) == 0)
|
2018-07-05 13:57:50 +02:00
|
|
|
fputs ("-----END PGP SIGNATURE-----\n", fp);
|
2013-05-29 12:28:08 +02:00
|
|
|
else
|
2018-07-05 13:57:50 +02:00
|
|
|
fputs (buffer, fp);
|