Fixed #65 - Quoted-Printable ? char bug

This commit is contained in:
Bobbi Webber-Manners 2021-08-28 23:19:48 -04:00
parent 9c4baa170d
commit 52f6b664e4
2 changed files with 7 additions and 7 deletions

View File

@ -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);

View File

@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////
// EMAIL_COMMON.H
// Definitions shared between pop65.c and email.c
// Bobbi June 2020
// Bobbi August 2021
/////////////////////////////////////////////////////////////////
#include <stdint.h>
#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