[Commits] [SCM] claws branch, master, updated. 3.14.1-154-g705f448
wwp at claws-mail.org
wwp at claws-mail.org
Fri Jan 20 10:50:07 CET 2017
The branch, master has been updated
via 705f448cafcff1d770b97ede84bdd37c0d36b5a8 (commit)
from db6a1558f99ad7ffd8c88240bcc08a79a58e0766 (commit)
Summary of changes:
src/common/defs.h | 2 ++
src/common/utils.c | 2 +-
src/compose.c | 18 ++++++++++--------
src/messageview.c | 2 +-
src/news.c | 10 +++++-----
src/plugins/fetchinfo/fetchinfo_plugin.c | 22 ++++++++--------------
src/plugins/vcalendar/vcal_manager.c | 7 ++++---
src/wizard.c | 6 +++---
8 files changed, 34 insertions(+), 35 deletions(-)
- Log -----------------------------------------------------------------
commit 705f448cafcff1d770b97ede84bdd37c0d36b5a8
Author: wwp <wwp at free.fr>
Date: Fri Jan 20 10:48:08 2017 +0100
Normalize rfc822 date handling by using decent buffer sizes everywhere (128,
which is way more than what RFC822 says: 37 max) and specific buffers.
diff --git a/src/common/defs.h b/src/common/defs.h
index c10ac65..4c4fd39 100644
--- a/src/common/defs.h
+++ b/src/common/defs.h
@@ -134,6 +134,8 @@
#define BUFFSIZE 8192
+#define RFC822_DATE_BUFFSIZE 128
+
#ifndef MAXPATHLEN
# define MAXPATHLEN 4095
#endif
diff --git a/src/common/utils.c b/src/common/utils.c
index b13d09a..cb48221 100644
--- a/src/common/utils.c
+++ b/src/common/utils.c
@@ -3533,7 +3533,7 @@ static void _get_rfc822_date(gchar *buf, gint len, gboolean hidetz)
gchar day[4], mon[4];
gint dd, hh, mm, ss, yyyy;
struct tm buf1;
- gchar buf2[BUFFSIZE];
+ gchar buf2[RFC822_DATE_BUFFSIZE];
t = time(NULL);
lt = localtime_r(&t, &buf1);
diff --git a/src/compose.c b/src/compose.c
index 07bdeaf..21dae0c 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -5445,6 +5445,7 @@ static gint compose_redirect_write_headers_from_headerlist(Compose *compose,
static gint compose_redirect_write_headers(Compose *compose, FILE *fp)
{
+ gchar date[RFC822_DATE_BUFFSIZE];
gchar buf[BUFFSIZE];
gchar *str;
const gchar *entstr;
@@ -5457,9 +5458,9 @@ static gint compose_redirect_write_headers(Compose *compose, FILE *fp)
/* Resent-Date */
if (prefs_common.hide_timezone)
- get_rfc822_date_hide_tz(buf, sizeof(buf));
+ get_rfc822_date_hide_tz(date, sizeof(date));
else
- get_rfc822_date(buf, sizeof(buf));
+ get_rfc822_date(date, sizeof(date));
err |= (fprintf(fp, "Resent-Date: %s\n", buf) < 0);
/* Resent-From */
@@ -6566,6 +6567,7 @@ static gchar *compose_get_manual_headers_info(Compose *compose)
static gchar *compose_get_header(Compose *compose)
{
+ gchar date[RFC822_DATE_BUFFSIZE];
gchar buf[BUFFSIZE];
const gchar *entry_str;
gchar *str;
@@ -6583,10 +6585,10 @@ static gchar *compose_get_header(Compose *compose)
/* Date */
if (prefs_common.hide_timezone)
- get_rfc822_date_hide_tz(buf, sizeof(buf));
+ get_rfc822_date_hide_tz(date, sizeof(date));
else
- get_rfc822_date(buf, sizeof(buf));
- g_string_append_printf(header, "Date: %s\n", buf);
+ get_rfc822_date(date, sizeof(date));
+ g_string_append_printf(header, "Date: %s\n", date);
/* From */
@@ -12136,15 +12138,15 @@ static MsgInfo *compose_msginfo_new_from_compose(Compose *compose)
{
MsgInfo *newmsginfo;
GSList *list;
- gchar buf[BUFFSIZE];
+ gchar date[RFC822_DATE_BUFFSIZE];
cm_return_val_if_fail( compose != NULL, NULL );
newmsginfo = procmsg_msginfo_new();
/* date is now */
- get_rfc822_date(buf, sizeof(buf));
- newmsginfo->date = g_strdup(buf);
+ get_rfc822_date(date, sizeof(date));
+ newmsginfo->date = g_strdup(date);
/* from */
if (compose->from_name) {
diff --git a/src/messageview.c b/src/messageview.c
index 4e15e07..8ff089e 100644
--- a/src/messageview.c
+++ b/src/messageview.c
@@ -817,7 +817,7 @@ static gint disposition_notification_send(MsgInfo *msginfo)
gchar *foo = NULL;
gboolean queued_removed = FALSE;
gchar *boundary = NULL;
- gchar buf_date[BUFFSIZE];
+ gchar buf_date[RFC822_DATE_BUFFSIZE];
gchar *date = NULL;
gchar *orig_to = NULL;
gchar *enc_sub = NULL;
diff --git a/src/news.c b/src/news.c
index d510da9..720b069 100644
--- a/src/news.c
+++ b/src/news.c
@@ -920,7 +920,7 @@ static MsgInfo *news_parse_xover(struct newsnntp_xover_resp_item *item)
msginfo->inreplyto = g_strdup(p);
}
g_free(tmp);
- }
+ }
return msginfo;
}
@@ -929,7 +929,7 @@ gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
{
gchar * tmp;
FILE * tmpfp;
- gchar buf[BUFFSIZE];
+ gchar date[RFC822_DATE_BUFFSIZE];
tmp = g_strdup_printf("%s%ccancel%p", get_tmp_dir(),
G_DIR_SEPARATOR, msginfo);
@@ -946,9 +946,9 @@ gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
}
if (prefs_common.hide_timezone)
- get_rfc822_date_hide_tz(buf, sizeof(buf));
+ get_rfc822_date_hide_tz(date, sizeof(date));
else
- get_rfc822_date(buf, sizeof(buf));
+ get_rfc822_date(date, sizeof(date));
if (fprintf(tmpfp, "From: %s\r\n"
"Newsgroups: %s\r\n"
"Subject: cmsg cancel <%s>\r\n"
@@ -964,7 +964,7 @@ gint news_cancel_article(Folder * folder, MsgInfo * msginfo)
msginfo->msgid,
msginfo->from,
msginfo->from,
- buf) < 0) {
+ date) < 0) {
FILE_OP_ERROR(tmp, "fprintf");
fclose(tmpfp);
claws_unlink(tmp);
diff --git a/src/plugins/fetchinfo/fetchinfo_plugin.c b/src/plugins/fetchinfo/fetchinfo_plugin.c
index d5e374e..04faead 100644
--- a/src/plugins/fetchinfo/fetchinfo_plugin.c
+++ b/src/plugins/fetchinfo/fetchinfo_plugin.c
@@ -49,18 +49,12 @@ static guint mail_receive_hook_id;
static FetchinfoConfig config;
static PrefParam param[] = {
- {"fetchinfo_enable", "FALSE", &config.fetchinfo_enable,
- P_BOOL, NULL, NULL, NULL},
- {"fetchinfo_uidl", "TRUE", &config.fetchinfo_uidl,
- P_BOOL, NULL, NULL, NULL},
- {"fetchinfo_account", "TRUE", &config.fetchinfo_account,
- P_BOOL, NULL, NULL, NULL},
- {"fetchinfo_server", "TRUE", &config.fetchinfo_server,
- P_BOOL, NULL, NULL, NULL},
- {"fetchinfo_userid", "TRUE", &config.fetchinfo_userid,
- P_BOOL, NULL, NULL, NULL},
- {"fetchinfo_time", "TRUE", &config.fetchinfo_time,
- P_BOOL, NULL, NULL, NULL},
+ {"fetchinfo_enable", "FALSE", &config.fetchinfo_enable, P_BOOL, NULL, NULL, NULL},
+ {"fetchinfo_uidl", "TRUE", &config.fetchinfo_uidl, P_BOOL, NULL, NULL, NULL},
+ {"fetchinfo_account", "TRUE", &config.fetchinfo_account, P_BOOL, NULL, NULL, NULL},
+ {"fetchinfo_server", "TRUE", &config.fetchinfo_server, P_BOOL, NULL, NULL, NULL},
+ {"fetchinfo_userid", "TRUE", &config.fetchinfo_userid, P_BOOL, NULL, NULL, NULL},
+ {"fetchinfo_time", "TRUE", &config.fetchinfo_time, P_BOOL, NULL, NULL, NULL},
{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
};
@@ -88,7 +82,7 @@ static gboolean mail_receive_hook(gpointer source, gpointer data)
Pop3Session *session;
gchar *newheaders;
gchar *newdata;
- gchar date[PREFSBUFSIZE];
+ gchar date[RFC822_DATE_BUFFSIZE];
if (!config.fetchinfo_enable) {
return FALSE;
@@ -101,7 +95,7 @@ static gboolean mail_receive_hook(gpointer source, gpointer data)
FALSE );
session = mail_receive_data->session;
- get_rfc822_date(date, PREFSBUFSIZE);
+ get_rfc822_date(date, sizeof(date));
newheaders = g_strdup("");
if (config.fetchinfo_uidl)
diff --git a/src/plugins/vcalendar/vcal_manager.c b/src/plugins/vcalendar/vcal_manager.c
index 6732fd5..964beec 100644
--- a/src/plugins/vcalendar/vcal_manager.c
+++ b/src/plugins/vcalendar/vcal_manager.c
@@ -50,6 +50,7 @@
#include "folder.h"
#include "quoted-printable.h"
#include "utils.h"
+#include "defs.h"
#ifdef G_OS_WIN32
#define getuid() 0
@@ -544,7 +545,7 @@ static gchar *write_headers_date(const gchar *uid)
{
gchar subject[512];
gchar *t_subject;
- gchar date[128];
+ gchar date[RFC822_DATE_BUFFSIZE];
time_t t;
struct tm lt;
@@ -1182,7 +1183,7 @@ static gchar *write_headers(PrefsAccount *account,
gboolean is_pseudo_display)
{
gchar *subject = NULL;
- gchar date[128];
+ gchar date[RFC822_DATE_BUFFSIZE];
gchar *save_folder = NULL;
gchar *result = NULL;
gchar *queue_headers = NULL;
@@ -1323,7 +1324,7 @@ static gchar *write_headers_ical(PrefsAccount *account,
gchar *orga)
{
gchar subject[512];
- gchar date[128];
+ gchar date[RFC822_DATE_BUFFSIZE];
gchar *result = NULL;
gchar *method_str = NULL;
gchar *summary = NULL;
diff --git a/src/wizard.c b/src/wizard.c
index 1fac967..d16a8b4 100644
--- a/src/wizard.c
+++ b/src/wizard.c
@@ -505,7 +505,7 @@ static void initialize_fonts(WizardWindow *wizard)
static void write_welcome_email(WizardWindow *wizard)
{
- gchar buf_date[64];
+ gchar date[RFC822_DATE_BUFFSIZE];
gchar *head=NULL;
gchar *body=NULL;
gchar *msg=NULL;
@@ -515,7 +515,7 @@ static void write_welcome_email(WizardWindow *wizard)
gchar *file = get_tmp_file();
gchar enc_from_name[BUFFSIZE], enc_to_name[BUFFSIZE], enc_subject[BUFFSIZE];
- get_rfc822_date(buf_date, sizeof(buf_date));
+ get_rfc822_date(date, sizeof(date));
conv_encode_header_full(enc_subject, sizeof(enc_subject),
C_("Welcome Mail Subject", "Welcome to Claws Mail"),
@@ -539,7 +539,7 @@ static void write_welcome_email(WizardWindow *wizard)
USERS_ML_ADDR,
enc_to_name,
gtk_entry_get_text(GTK_ENTRY(wizard->email)),
- buf_date, enc_subject, XFACE, FACE);
+ date, enc_subject, XFACE, FACE);
body = g_strdup_printf(
_("\n"
"Welcome to Claws Mail\n"
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list