From e57d1b319282973949d10372a6e13db625d20fef Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 13 Jul 2016 21:56:16 +0200 Subject: rfc2045: new parameter for blaze822_mime_body to allow freeing of new chunk --- blaze822.h | 2 +- rfc2045.c | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/blaze822.h b/blaze822.h index f39cf78..a969aaa 100644 --- a/blaze822.h +++ b/blaze822.h @@ -30,5 +30,5 @@ int blaze822_decode_b64(char *start, char *stop, char **deco, size_t *decleno); // rfc2045.c int blaze822_check_mime(struct message *msg); -int blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyleno); +int blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyleno, char **bodychunko); int blaze822_multipart(struct message *msg, struct message **imsg); diff --git a/rfc2045.c b/rfc2045.c index 8f913a1..e5e19ff 100644 --- a/rfc2045.c +++ b/rfc2045.c @@ -16,7 +16,8 @@ blaze822_check_mime(struct message *msg) } int -blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyleno) +blaze822_mime_body(struct message *msg, + char **cto, char **bodyo, size_t *bodyleno, char **bodychunko) { if (!msg->body || !msg->bodyend) { *bodyo = 0; @@ -37,16 +38,20 @@ blaze822_mime_body(struct message *msg, char **cto, char **bodyo, size_t *bodyle *cto = ct; if (cte) { - if (strncasecmp(cte, "quoted-printable", 16) == 0) + if (strncasecmp(cte, "quoted-printable", 16) == 0) { blaze822_decode_qp(msg->body, msg->bodyend, bodyo, bodyleno); - else if (strncasecmp(cte, "base64", 6) == 0) + *bodychunko = *bodyo; + } else if (strncasecmp(cte, "base64", 6) == 0) { blaze822_decode_b64(msg->body, msg->bodyend, bodyo, bodyleno); - else + *bodychunko = *bodyo; + } else { cte = 0; + } } if (!cte) { *bodyo = msg->body; *bodyleno = msg->bodyend - msg->body; + *bodychunko = 0; } return 1; -- cgit 1.4.1