Skip to content

Commit

Permalink
Fixed #65 - Quoted-Printable ? char bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbimanners committed Aug 29, 2021
1 parent 9c4baa1 commit 52f6b66
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions apps/email.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand All @@ -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;
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -1224,7 +1224,7 @@ void email_pager(struct emailhdrs *h) {
} 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);
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions apps/email_common.h
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 52f6b66

Please sign in to comment.