From 52f6b664e4f90acd5cb92c0a1cae7f65bce00758 Mon Sep 17 00:00:00 2001 From: Bobbi Webber-Manners Date: Sat, 28 Aug 2021 23:19:48 -0400 Subject: [PATCH] Fixed #65 - Quoted-Printable ? char bug --- apps/email.c | 10 +++++----- apps/email_common.h | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/email.c b/apps/email.c index 15f1d56..bef4e91 100644 --- a/apps/email.c +++ b/apps/email.c @@ -553,7 +553,7 @@ uint8_t hexdigit(char c) { * p - Pointer to buffer to decode. Results written in place. * Returns number of bytes decoded */ -uint16_t decode_quoted_printable(uint8_t *p) { +uint16_t decode_quoted_printable(uint8_t *p, uint8_t isheader) { uint16_t i = 0, j = 0; uint8_t c; while (c = p[i]) { @@ -564,7 +564,7 @@ uint16_t decode_quoted_printable(uint8_t *p) { c = 16 * hexdigit(p[i + 1]) + hexdigit(p[i + 2]); p[j++] = c; i += 3; - } else if (c == '?') + } else if ((c == '?') && isheader) break; else { p[j++] = c; @@ -601,7 +601,7 @@ void decode_qp_header(char *p) { if (p[8] == 'B') decode_base64(linebuf); else - decode_quoted_printable(linebuf); + decode_quoted_printable(linebuf, 1); while (linebuf[i]) { if ((linebuf[i] <= 127) && (linebuf[i] >= 32)) linebuf[j++] = linebuf[i]; @@ -1224,7 +1224,7 @@ prompt_dl: } else if (mime == 4) { switch (mime_enc) { case ENC_QP: - chars = decode_quoted_printable(writep); + chars = decode_quoted_printable(writep, 0); break; case ENC_B64: chars = decode_base64(writep); @@ -1858,7 +1858,7 @@ void get_email_body(struct emailhdrs *h, FILE *f, char mode) { } else if (mime == 4) { switch (mime_enc) { case ENC_QP: - chars = decode_quoted_printable(writep); + chars = decode_quoted_printable(writep, 0); break; case ENC_B64: chars = decode_base64(writep); diff --git a/apps/email_common.h b/apps/email_common.h index da51e55..b8aa1b9 100644 --- a/apps/email_common.h +++ b/apps/email_common.h @@ -1,12 +1,12 @@ ///////////////////////////////////////////////////////////////// // EMAIL_COMMON.H // Definitions shared between pop65.c and email.c -// Bobbi June 2020 +// Bobbi August 2021 ///////////////////////////////////////////////////////////////// #include -#define PROGNAME "emai//er v2.1.7" +#define PROGNAME "emai//er v2.1.8" // Configuration params from EMAIL.CFG char cfg_server[40]; // IP of POP3 server