From ebf669cdbf7854f03113a937605658f100aefd48 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Fri, 9 Oct 2015 16:04:25 +0200 Subject: updated libquickmail to 0.1.20 --- 3rdParty/libquickmail/quickmail.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to '3rdParty/libquickmail/quickmail.c') diff --git a/3rdParty/libquickmail/quickmail.c b/3rdParty/libquickmail/quickmail.c index 249eeee..d6827ff 100644 --- a/3rdParty/libquickmail/quickmail.c +++ b/3rdParty/libquickmail/quickmail.c @@ -41,7 +41,7 @@ #define LIBQUICKMAIL_VERSION_MAJOR 0 #define LIBQUICKMAIL_VERSION_MINOR 1 -#define LIBQUICKMAIL_VERSION_MICRO 19 +#define LIBQUICKMAIL_VERSION_MICRO 20 #define VERSION_STRINGIZE_(major, minor, micro) #major"."#minor"."#micro #define VERSION_STRINGIZE(major, minor, micro) VERSION_STRINGIZE_(major, minor, micro) @@ -529,6 +529,7 @@ DLL_EXPORT_LIBQUICKMAIL char* quickmail_get_body (quickmail mailobj) do { if ((p = (char*)realloc(result, resultlen + BODY_BUFFER_SIZE)) == NULL) { free(result); + result = NULL; DEBUG_ERROR(ERRMSG_MEMORY_ALLOCATION_ERROR) break; } @@ -646,26 +647,25 @@ DLL_EXPORT_LIBQUICKMAIL size_t quickmail_get_data (void* ptr, size_t size, size_ char* s; //generate header part char** p = &mailobj->buf; - mailobj->buf = NULL; str_append(p, "User-Agent: libquickmail v" LIBQUICKMAIL_VERSION NEWLINE); if (mailobj->timestamp != 0) { char timestamptext[32]; - if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S %z", localtime(&mailobj->timestamp))) { + if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S %z", localtime(&mailobj->timestamp))) { str_append(p, "Date: "); str_append(p, timestamptext); str_append(p, NEWLINE); } -#ifdef _WIN32 +#ifdef _WIN32 //fallback method for Windows when %z (time zone offset) fails - else if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S", localtime(&mailobj->timestamp))) { - TIME_ZONE_INFORMATION tzinfo; - if (GetTimeZoneInformation(&tzinfo) != TIME_ZONE_ID_INVALID) - sprintf(timestamptext + strlen(timestamptext), " %c%02i%02i", (tzinfo.Bias > 0 ? '-' : '+'), (int)-tzinfo.Bias / 60, (int)-tzinfo.Bias % 60); + else if (strftime(timestamptext, sizeof(timestamptext), "%a, %d %b %Y %H:%M:%S", localtime(&mailobj->timestamp))) { + TIME_ZONE_INFORMATION tzinfo; + if (GetTimeZoneInformation(&tzinfo) != TIME_ZONE_ID_INVALID) + sprintf(timestamptext + strlen(timestamptext), " %c%02i%02i", (tzinfo.Bias > 0 ? '-' : '+'), (int)-tzinfo.Bias / 60, (int)-tzinfo.Bias % 60); str_append(p, "Date: "); str_append(p, timestamptext); str_append(p, NEWLINE); } -#endif +#endif } if (mailobj->from && *mailobj->from) { str_append(p, "From: <"); @@ -709,7 +709,7 @@ DLL_EXPORT_LIBQUICKMAIL size_t quickmail_get_data (void* ptr, size_t size, size_ str_append(p, mailobj->mime_boundary_body); str_append(p, NEWLINE); } - mailobj->buflen = strlen(mailobj->buf); + mailobj->buflen = (mailobj->buf ? strlen(mailobj->buf) : 0); mailobj->current++; } if (mailobj->buflen == 0 && mailobj->current == MAILPART_BODY) { @@ -737,7 +737,7 @@ DLL_EXPORT_LIBQUICKMAIL size_t quickmail_get_data (void* ptr, size_t size, size_ mailobj->buf = str_append(&mailobj->buf, "Content-Type: "); mailobj->buf = str_append(&mailobj->buf, (mailobj->bodylist && mailobj->current_attachment->filename ? mailobj->current_attachment->filename : default_mime_type)); mailobj->buf = str_append(&mailobj->buf, NEWLINE "Content-Transfer-Encoding: 8bit" NEWLINE "Content-Disposition: inline" NEWLINE NEWLINE); - mailobj->buflen = strlen(mailobj->buf); + mailobj->buflen = (mailobj->buf ? strlen(mailobj->buf) : 0); } } if (mailobj->buflen == 0 && mailobj->current_attachment && mailobj->current_attachment->handle) { @@ -973,7 +973,7 @@ DLL_EXPORT_LIBQUICKMAIL const char* quickmail_send (quickmail mailobj, const cha curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients); //set callback function for getting message body curl_easy_setopt(curl, CURLOPT_READFUNCTION, quickmail_get_data); - curl_easy_setopt(curl, CURLOPT_READDATA, mailobj); + curl_easy_setopt(curl, CURLOPT_READDATA, mailobj); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); //set CURLOPT_UPLOAD to 1 to not use VRFY and other unneeded commands //enable debugging if requested if (mailobj->debuglog) { -- cgit v1.2.3-54-g00ecf