2015-01-26 17:35:10 +01:00
|
|
|
---
|
2017-04-28 16:47:43 +02:00
|
|
|
crypt_gpgme.c | 2 +-
|
2016-11-23 11:17:15 +01:00
|
|
|
lib.c | 12 ++++++++++++
|
|
|
|
lib.h | 1 +
|
|
|
|
pager.c | 2 +-
|
|
|
|
pgp.c | 24 ++++++++++++------------
|
|
|
|
5 files changed, 27 insertions(+), 14 deletions(-)
|
2015-01-26 17:35:10 +01:00
|
|
|
|
2017-04-28 16:47:43 +02:00
|
|
|
--- crypt_gpgme.c
|
|
|
|
+++ crypt_gpgme.c 2017-04-28 13:37:50.216829516 +0000
|
|
|
|
@@ -2301,7 +2301,7 @@ static void copy_clearsigned(gpgme_data_
|
|
|
|
|
2016-11-23 11:17:15 +01:00
|
|
|
if (armor_header)
|
|
|
|
{
|
2017-04-28 16:47:43 +02:00
|
|
|
- if (buf[0] == '\n')
|
2016-11-23 11:17:15 +01:00
|
|
|
+ if (buf[0] == '\n' || (buf[0] == '\r' && buf[1] == '\n'))
|
2017-04-28 16:47:43 +02:00
|
|
|
armor_header = 0;
|
2016-11-23 11:17:15 +01:00
|
|
|
continue;
|
|
|
|
}
|
2013-05-29 12:28:08 +02:00
|
|
|
--- lib.c
|
2017-04-28 16:47:43 +02:00
|
|
|
+++ lib.c 2017-04-28 13:36:40.198162342 +0000
|
2016-05-12 16:10:16 +02:00
|
|
|
@@ -880,6 +880,18 @@ 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)
|
|
|
|
+{
|
|
|
|
+ size_t xa, xb;
|
|
|
|
+ xa = strcspn(NONULL(a), "\r\n");
|
|
|
|
+ xb = strcspn(NONULL(b), "\r\n");
|
|
|
|
+ if (xb != xa)
|
|
|
|
+ return -1;
|
|
|
|
+ if (!xa)
|
|
|
|
+ return 0;
|
|
|
|
+ return strncmp(NONULL(a), NONULL(b), xa);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int mutt_strcasecmp(const char *a, const char *b)
|
|
|
|
{
|
|
|
|
return strcasecmp(NONULL(a), NONULL(b));
|
|
|
|
--- lib.h
|
2017-04-28 16:47:43 +02:00
|
|
|
+++ lib.h 2017-04-28 13:38:18.944282628 +0000
|
|
|
|
@@ -168,6 +168,7 @@ int mutt_copy_bytes(FILE *, FILE *, size
|
|
|
|
int mutt_rx_sanitize_string(char *, size_t, const char *);
|
|
|
|
int mutt_strcasecmp(const char *, const char *);
|
|
|
|
int mutt_strcmp(const char *, const char *);
|
|
|
|
+int mutt_strxcmp(const char *, const char *);
|
|
|
|
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 *);
|
2013-05-29 12:28:08 +02:00
|
|
|
--- pager.c
|
2017-04-28 16:47:43 +02:00
|
|
|
+++ pager.c 2017-04-28 13:39:16.319190287 +0000
|
|
|
|
@@ -773,7 +773,7 @@ static void resolve_types(char *buf, cha
|
|
|
|
lineInfo[n].type = MT_COLOR_NORMAL;
|
|
|
|
else if (check_attachment_marker((char *) raw) == 0)
|
2013-05-29 12:28:08 +02:00
|
|
|
lineInfo[n].type = MT_COLOR_ATTACHMENT;
|
2017-04-28 16:47:43 +02:00
|
|
|
- else if ((mutt_strcmp("-- \n", buf) == 0) || (mutt_strcmp("-- \r\n", buf) == 0))
|
|
|
|
+ else if (mutt_strxcmp("-- \n", buf) == 0)
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
|
|
|
i = n + 1;
|
|
|
|
|
|
|
|
--- pgp.c
|
2017-04-28 16:47:43 +02:00
|
|
|
+++ pgp.c 2017-04-28 13:40:43.301534032 +0000
|
|
|
|
@@ -282,7 +282,7 @@ static void pgp_copy_clearsigned(FILE *f
|
2015-01-26 17:35:10 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2017-04-28 16:47:43 +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;
|
2017-04-28 16:47:43 +02:00
|
|
|
|
2015-01-26 17:35:10 +01:00
|
|
|
if (armor_header)
|
2017-04-28 16:47:43 +02:00
|
|
|
@@ -347,14 +347,14 @@ int pgp_application_pgp_handler(BODY *m,
|
2015-01-26 17:35:10 +01:00
|
|
|
{
|
2013-05-29 12:28:08 +02:00
|
|
|
clearsign = 0;
|
|
|
|
|
2017-04-28 16:47:43 +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;
|
2017-04-28 16:47:43 +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
|
|
|
{
|
2017-04-28 16:47:43 +02:00
|
|
|
clearsign = 1;
|
2013-05-29 12:28:08 +02:00
|
|
|
needpass = 0;
|
|
|
|
}
|
2017-04-28 16:47:43 +02:00
|
|
|
- else if (mutt_strcmp("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
|
|
|
|
+ else if (mutt_strxcmp("PUBLIC KEY BLOCK-----\n", buf + 15) == 0)
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
|
|
|
needpass = 0;
|
|
|
|
pgp_keyblock = 1;
|
2017-04-28 16:47:43 +02:00
|
|
|
@@ -388,9 +388,9 @@ int pgp_application_pgp_handler(BODY *m,
|
|
|
|
|
|
|
|
fputs(buf, tmpfp);
|
2013-05-29 12:28:08 +02:00
|
|
|
|
2017-04-28 16:47:43 +02:00
|
|
|
- if ((needpass && (mutt_strcmp("-----END PGP MESSAGE-----\n", buf) == 0)) ||
|
|
|
|
- (!needpass && ((mutt_strcmp("-----END PGP SIGNATURE-----\n", buf) == 0) ||
|
|
|
|
- (mutt_strcmp("-----END PGP PUBLIC KEY BLOCK-----\n", buf) == 0))))
|
|
|
|
+ if ((needpass && (mutt_strxcmp("-----END PGP MESSAGE-----\n", buf) == 0)) ||
|
|
|
|
+ (!needpass && ((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)
|
|
|
|
@@ -631,11 +631,11 @@ static int pgp_check_traditional_one_bod
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
2017-04-28 16:47:43 +02:00
|
|
|
if (mutt_strncmp("-----BEGIN PGP ", buf, 15) == 0)
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
2017-04-28 16:47:43 +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
|
|
|
}
|
|
|
|
}
|
2017-04-28 16:47:43 +02:00
|
|
|
@@ -1120,9 +1120,9 @@ BODY *pgp_sign_message(BODY *a)
|
2013-05-29 12:28:08 +02:00
|
|
|
*/
|
2017-04-28 16:47:43 +02:00
|
|
|
while (fgets(buffer, sizeof(buffer) - 1, pgpout) != NULL)
|
2013-05-29 12:28:08 +02:00
|
|
|
{
|
2017-04-28 16:47:43 +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)
|
2017-04-28 16:47:43 +02:00
|
|
|
fputs("-----END PGP SIGNATURE-----\n", fp);
|
2013-05-29 12:28:08 +02:00
|
|
|
else
|
2017-04-28 16:47:43 +02:00
|
|
|
fputs(buffer, fp);
|