[Commits] [SCM] claws branch, master, updated. 3.13.0-61-ge72d26e
Colin
colin at claws-mail.org
Fri Nov 13 11:57:04 CET 2015
The branch, master has been updated
via e72d26e92357a15163457a3f5af479ce53aaf5b3 (commit)
via 49d9491bae0b3534083a5190de3250da3040f36d (commit)
via 24e8816b793686174e1eca453350d9e613d13e56 (commit)
via de770e4c9c5cc1a3f29b7902d1367e71308b81f9 (commit)
via 416fbdb5fa8c9a49d3b982b16b833419b3412a5e (commit)
via 24f49cb6a765ec9d6b6f53dc60239e9cc7c0d091 (commit)
via d7e8f002018245de9443feb1ad88ce9c176dfef0 (commit)
via 90028bb20a5fa177f5048f71c8d9499202f2be0c (commit)
via d552194e1b9992e8c2aac4974b5831f1c2fa7c70 (commit)
via 53b36de8db2ed7d8b60d37afc544393e9cb603cd (commit)
from 8eadc80ce1e3ca3b0168f86f8c4f7bc29165d585 (commit)
Summary of changes:
src/plugins/archive/archiver_gtk.c | 8 +-
src/plugins/archive/libarchive_archive.c | 7 +-
src/plugins/clamd/libclamd/clamd-plugin.c | 10 +--
src/plugins/libravatar/libravatar_missing.c | 3 +-
src/plugins/mailmbox/mailimf.c | 85 +++++++++++---------
src/plugins/mailmbox/mailmbox.c | 2 +-
src/plugins/mailmbox/mailmbox_types.c | 4 +-
src/plugins/mailmbox/mmapstring.c | 5 +-
src/plugins/mailmbox/plugin_gtk.c | 16 ++--
src/plugins/managesieve/managesieve.c | 6 +-
src/plugins/notification/notification_core.c | 8 +-
src/plugins/pdf_viewer/poppler_viewer.c | 3 +-
src/plugins/pgpcore/select-keys.c | 6 +-
src/plugins/pgpcore/sgpgme.c | 24 +++---
src/plugins/python/python-hooks.c | 33 ++++++--
src/plugins/python/python-hooks.h | 1 +
src/plugins/python/python_plugin.c | 2 +
src/plugins/rssyl/libfeed/parser_atom10.c | 6 +-
src/plugins/smime/smime.c | 2 +
.../vcalendar/libical/libical/icalcomponent.c | 8 +-
.../libical/libical/icalderivedvalue.c.in | 4 +-
src/plugins/vcalendar/libical/libical/icalerror.c | 9 ---
src/plugins/vcalendar/libical/libical/icalerror.h | 2 -
src/plugins/vcalendar/libical/libical/icalmime.c | 8 +-
.../vcalendar/libical/libical/icalparameter.c | 6 +-
.../vcalendar/libical/libical/icalproperty.c | 19 +++--
src/plugins/vcalendar/libical/libical/icalrecur.c | 19 ++---
src/plugins/vcalendar/libical/libical/icaltime.c | 1 +
src/plugins/vcalendar/libical/libical/icalvalue.c | 2 +
src/plugins/vcalendar/libical/libical/sspm.c | 5 +-
.../libical/scripts/mkderivedproperties.pl | 8 +-
.../vcalendar/libical/scripts/mkderivedvalues.pl | 3 +-
32 files changed, 191 insertions(+), 134 deletions(-)
- Log -----------------------------------------------------------------
commit e72d26e92357a15163457a3f5af479ce53aaf5b3
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 11:47:09 2015 +0100
Wow. Such data, so leak, very unfreed
diff --git a/src/plugins/archive/archiver_gtk.c b/src/plugins/archive/archiver_gtk.c
index f42181d..1fc0910 100644
--- a/src/plugins/archive/archiver_gtk.c
+++ b/src/plugins/archive/archiver_gtk.c
@@ -284,12 +284,16 @@ static void create_md5sum(const gchar* file, const gchar* md5_file) {
gchar* md5sum = malloc(33);
debug_print("Creating md5sum file: %s\n", md5_file);
- if (md5_hex_digest_file(md5sum, (const unsigned char *) file) == -1)
+ if (md5_hex_digest_file(md5sum, (const unsigned char *) file) == -1) {
+ free(md5sum);
return;
+ }
debug_print("md5sum: %s\n", md5sum);
if ((fd =
- open(md5_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) == -1)
+ open(md5_file, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) == -1) {
+ free(md5sum);
return;
+ }
text = g_strrstr_len(file, strlen(file), "/");
if (text) {
text++;
diff --git a/src/plugins/archive/libarchive_archive.c b/src/plugins/archive/libarchive_archive.c
index ddedbda..d084f80 100644
--- a/src/plugins/archive/libarchive_archive.c
+++ b/src/plugins/archive/libarchive_archive.c
@@ -349,7 +349,7 @@ static int archive_copy_data(struct archive* in, struct archive* out) {
#endif
void archive_add_file(gchar* path) {
- struct file_info* file = archive_new_file_info();
+ struct file_info* file;
gchar* filename = NULL;
g_return_if_fail(path != NULL);
@@ -363,6 +363,7 @@ void archive_add_file(gchar* path) {
g_return_if_fail(filename != NULL);
filename++;
+ file = archive_new_file_info();
file->name = g_strdup(filename);
file->path = strip_leading_dot_slash(dirname(path));
archive_add_to_list(file);
diff --git a/src/plugins/libravatar/libravatar_missing.c b/src/plugins/libravatar/libravatar_missing.c
index c884899..47eb188 100644
--- a/src/plugins/libravatar/libravatar_missing.c
+++ b/src/plugins/libravatar/libravatar_missing.c
@@ -60,7 +60,8 @@ GHashTable *missing_load_from_file(const gchar *filename)
if (value == NULL) {
g_warning("cannot allocate memory");
g_hash_table_destroy(table);
- return NULL;
+ table = NULL;
+ goto close_exit;
}
*value = (time_t)seen;
g_hash_table_insert(table, g_strdup(md5sum), value);
diff --git a/src/plugins/mailmbox/mailimf.c b/src/plugins/mailmbox/mailimf.c
index 28374a3..352e901 100644
--- a/src/plugins/mailmbox/mailimf.c
+++ b/src/plugins/mailmbox/mailimf.c
@@ -3007,11 +3007,14 @@ static int mailimf_group_parse(const char * message, size_t length,
break;
case MAILIMF_ERROR_PARSE:
r = mailimf_cfws_parse(message, length, &cur_token);
- if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE))
- return r;
+ if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
+ res = r;
+ goto free_display_name;
+ }
break;
default:
- return r;
+ res = r;
+ goto free_display_name;
}
r = mailimf_semi_colon_parse(message, length, &cur_token);
@@ -3703,7 +3706,7 @@ mailimf_resent_field_parse(const char * message, size_t length,
&resent_date);
if (r != MAILIMF_NO_ERROR) {
res = r;
- goto err;
+ goto free_resent;
}
break;
case MAILIMF_RESENT_FIELD_FROM:
@@ -3711,7 +3714,7 @@ mailimf_resent_field_parse(const char * message, size_t length,
&resent_from);
if (r != MAILIMF_NO_ERROR) {
res = r;
- goto err;
+ goto free_resent;
}
break;
case MAILIMF_RESENT_FIELD_SENDER:
@@ -3719,7 +3722,7 @@ mailimf_resent_field_parse(const char * message, size_t length,
&resent_sender);
if (r != MAILIMF_NO_ERROR) {
res = r;
- goto err;
+ goto free_resent;
}
break;
case MAILIMF_RESENT_FIELD_TO:
@@ -3727,7 +3730,7 @@ mailimf_resent_field_parse(const char * message, size_t length,
&resent_to);
if (r != MAILIMF_NO_ERROR) {
res = r;
- goto err;
+ goto free_resent;
}
break;
case MAILIMF_RESENT_FIELD_CC:
@@ -3735,7 +3738,7 @@ mailimf_resent_field_parse(const char * message, size_t length,
&resent_cc);
if (r != MAILIMF_NO_ERROR) {
res = r;
- goto err;
+ goto free_resent;
}
break;
case MAILIMF_RESENT_FIELD_BCC:
@@ -3743,7 +3746,7 @@ mailimf_resent_field_parse(const char * message, size_t length,
&resent_bcc);
if (r != MAILIMF_NO_ERROR) {
res = r;
- goto err;
+ goto free_resent;
}
break;
case MAILIMF_RESENT_FIELD_MSG_ID:
@@ -3751,12 +3754,12 @@ mailimf_resent_field_parse(const char * message, size_t length,
&resent_msg_id);
if (r != MAILIMF_NO_ERROR) {
res = r;
- goto err;
+ goto free_resent;
}
break;
default:
res = MAILIMF_ERROR_PARSE;
- goto err;
+ goto free_resent;
}
resent_field = mailimf_resent_field_new(type, resent_date,
@@ -4170,7 +4173,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_FROM:
@@ -4183,7 +4186,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_SENDER:
@@ -4196,7 +4199,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_REPLY_TO:
@@ -4209,7 +4212,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_TO:
@@ -4222,7 +4225,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_CC:
@@ -4235,7 +4238,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_BCC:
@@ -4248,7 +4251,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_MESSAGE_ID:
@@ -4261,7 +4264,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_IN_REPLY_TO:
@@ -4274,7 +4277,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_REFERENCES:
@@ -4287,7 +4290,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_SUBJECT:
@@ -4300,7 +4303,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_COMMENTS:
@@ -4313,7 +4316,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_KEYWORDS:
@@ -4326,7 +4329,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_RETURN_PATH:
@@ -4339,7 +4342,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_RESENT_DATE:
@@ -4352,7 +4355,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_RESENT_FROM:
@@ -4365,7 +4368,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_RESENT_SENDER:
@@ -4378,7 +4381,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_RESENT_TO:
@@ -4391,7 +4394,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_RESENT_CC:
@@ -4404,7 +4407,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_RESENT_BCC:
@@ -4417,7 +4420,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
case MAILIMF_FIELD_RESENT_MSG_ID:
@@ -4430,7 +4433,7 @@ static int mailimf_field_parse(const char * message, size_t length,
}
else {
res = r;
- goto err;
+ goto free_fields;
}
break;
}
@@ -4453,7 +4456,7 @@ static int mailimf_field_parse(const char * message, size_t length,
subject, comments, keywords, optional_field);
if (field == NULL) {
res = MAILIMF_ERROR_MEMORY;
- goto free_field;
+ goto free_fields;
}
* result = field;
@@ -4461,7 +4464,7 @@ static int mailimf_field_parse(const char * message, size_t length,
return MAILIMF_NO_ERROR;
- free_field:
+ free_fields:
if (return_path != NULL)
mailimf_return_free(return_path);
if (resent_date != NULL)
@@ -5451,7 +5454,7 @@ static int mailimf_unstrict_msg_id_parse(const char * message, size_t length,
size_t * index,
char ** result)
{
- char * msgid;
+ char * msgid = NULL;
size_t cur_token;
int r;
@@ -5470,8 +5473,10 @@ static int mailimf_unstrict_msg_id_parse(const char * message, size_t length,
return r;
r = mailimf_parse_unwanted_msg_id(message, length, &cur_token);
- if (r != MAILIMF_NO_ERROR)
+ if (r != MAILIMF_NO_ERROR) {
+ free(msgid);
return r;
+ }
* result = msgid;
* index = cur_token;
@@ -6486,7 +6491,7 @@ static int mailimf_path_parse(const char * message, size_t length,
r = mailimf_greater_parse(message, length, &cur_token);
if (r != MAILIMF_NO_ERROR) {
res = r;
- goto err;
+ goto free_addr_spec;
}
path = mailimf_path_new(addr_spec);
@@ -6501,7 +6506,7 @@ static int mailimf_path_parse(const char * message, size_t length,
return MAILIMF_NO_ERROR;
free_addr_spec:
- if (addr_spec == NULL)
+ if (addr_spec != NULL)
mailimf_addr_spec_free(addr_spec);
err:
return res;
@@ -7282,7 +7287,7 @@ static int mailimf_envelope_field_parse(const char * message, size_t length,
subject, NULL, NULL, optional_field);
if (field == NULL) {
res = MAILIMF_ERROR_MEMORY;
- goto free_field;
+ goto free_fields;
}
* result = field;
@@ -7290,7 +7295,7 @@ static int mailimf_envelope_field_parse(const char * message, size_t length,
return MAILIMF_NO_ERROR;
- free_field:
+ free_fields:
if (orig_date != NULL)
mailimf_orig_date_free(orig_date);
if (from != NULL)
diff --git a/src/plugins/mailmbox/mailmbox.c b/src/plugins/mailmbox/mailmbox.c
index f37c0e9..3df5342 100644
--- a/src/plugins/mailmbox/mailmbox.c
+++ b/src/plugins/mailmbox/mailmbox.c
@@ -1072,7 +1072,7 @@ int claws_mailmbox_copy_msg_list(struct claws_mailmbox_folder * dest_folder,
r = claws_mailmbox_append_message_list(dest_folder, append_tab);
if (r != MAILMBOX_NO_ERROR) {
res = r;
- goto src_unlock;
+ goto free_list;
}
for(i = 0 ; i < carray_count(append_tab) ; i ++) {
diff --git a/src/plugins/python/python-hooks.c b/src/plugins/python/python-hooks.c
index e4e464f..e0d2873 100644
--- a/src/plugins/python/python-hooks.c
+++ b/src/plugins/python/python-hooks.c
@@ -42,6 +42,7 @@
static gboolean python_enabled = FALSE;
+static void *python_dlhandle = NULL;
#ifdef ENABLE_PYTHON
static GString *captured_stdout = NULL;
@@ -135,7 +136,8 @@ parasite_python_init(char **error)
}
/* This prevents errors such as "undefined symbol: PyExc_ImportError" */
- if (!dlopen(PYTHON_SHARED_LIB, RTLD_NOW | RTLD_GLOBAL))
+ python_dlhandle = dlopen(PYTHON_SHARED_LIB, RTLD_NOW | RTLD_GLOBAL);
+ if (python_dlhandle == NULL)
{
*error = g_strdup_printf("Parasite: Error on dlopen(): %s\n", dlerror());
return 0;
@@ -177,11 +179,17 @@ parasite_python_init(char **error)
" def flush(self):\n"
" pass\n"
"\n"
- ) == -1)
+ ) == -1) {
+ dlclose(python_dlhandle);
+ python_dlhandle = NULL;
return 0;
+ }
- if (!pygobject_init(-1, -1, -1))
+ if (!pygobject_init(-1, -1, -1)) {
+ dlclose(python_dlhandle);
+ python_dlhandle = NULL;
return 0;
+ }
pygtk = PyImport_ImportModule("gtk");
@@ -212,6 +220,8 @@ parasite_python_init(char **error)
}
} else {
*error = g_strdup("Parasite: Could not import gtk");
+ dlclose(python_dlhandle);
+ python_dlhandle = NULL;
return 0;
}
@@ -221,6 +231,17 @@ parasite_python_init(char **error)
}
void
+parasite_python_done(void)
+{
+#ifdef ENABLE_PYTHON
+ if(python_dlhandle != NULL) {
+ dlclose(python_dlhandle);
+ python_dlhandle = NULL;
+ }
+#endif
+}
+
+void
parasite_python_run(const char *command,
ParasitePythonLogger stdout_logger,
ParasitePythonLogger stderr_logger,
diff --git a/src/plugins/python/python-hooks.h b/src/plugins/python/python-hooks.h
index 2744fc3..dbde331 100644
--- a/src/plugins/python/python-hooks.h
+++ b/src/plugins/python/python-hooks.h
@@ -29,6 +29,7 @@
typedef void (*ParasitePythonLogger)(const char *text, gpointer user_data);
int parasite_python_init(char **error);
+void parasite_python_done(void);
void parasite_python_run(const char *command,
ParasitePythonLogger stdout_logger,
ParasitePythonLogger stderr_logger,
diff --git a/src/plugins/python/python_plugin.c b/src/plugins/python/python_plugin.c
index 2ce32f3..b34e589 100644
--- a/src/plugins/python/python_plugin.c
+++ b/src/plugins/python/python_plugin.c
@@ -724,6 +724,8 @@ gboolean plugin_done(void)
/* finialize python interpreter */
Py_Finalize();
+ parasite_python_done();
+
debug_print("Python plugin done and unloaded.\n");
return FALSE;
}
diff --git a/src/plugins/smime/smime.c b/src/plugins/smime/smime.c
index 6251918..c4d0d85 100644
--- a/src/plugins/smime/smime.c
+++ b/src/plugins/smime/smime.c
@@ -841,12 +841,14 @@ gboolean smime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
fclose(fp);
claws_unlink(tmpfile);
g_free(tmpfile);
+ g_free(enccontent);
return FALSE;
}
if (fclose(fp) == EOF) {
FILE_OP_ERROR(tmpfile, "fclose");
claws_unlink(tmpfile);
g_free(tmpfile);
+ g_free(enccontent);
return FALSE;
}
} else {
diff --git a/src/plugins/vcalendar/libical/libical/icalcomponent.c b/src/plugins/vcalendar/libical/libical/icalcomponent.c
index b723086..c027ee9 100644
--- a/src/plugins/vcalendar/libical/libical/icalcomponent.c
+++ b/src/plugins/vcalendar/libical/libical/icalcomponent.c
@@ -254,9 +254,6 @@ icalcomponent_as_ical_string (icalcomponent* component)
const char* kind_string;
- buf = icalmemory_new_buffer(buf_size);
- buf_ptr = buf;
-
icalerror_check_arg_rz( (component!=0), "component");
icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT");
@@ -264,6 +261,9 @@ icalcomponent_as_ical_string (icalcomponent* component)
icalerror_check_arg_rz( (kind_string!=0),"Unknown kind of component");
+ buf = icalmemory_new_buffer(buf_size);
+ buf_ptr = buf;
+
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
@@ -301,7 +301,7 @@ icalcomponent_as_ical_string (icalcomponent* component)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
out_buf = icalmemory_tmp_copy(buf);
- free(buf);
+ icalmemory_free_buffer(buf);
return out_buf;
}
diff --git a/src/plugins/vcalendar/libical/libical/icalderivedvalue.c.in b/src/plugins/vcalendar/libical/libical/icalderivedvalue.c.in
index 519673b..2d7092a 100644
--- a/src/plugins/vcalendar/libical/libical/icalderivedvalue.c.in
+++ b/src/plugins/vcalendar/libical/libical/icalderivedvalue.c.in
@@ -90,9 +90,9 @@ icalvalue_kind icalvalue_string_to_kind(const char* str)
}
icalvalue* icalvalue_new_x (const char* v){
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
+ struct icalvalue_impl* impl;
icalerror_check_arg_rz( (v!=0),"v");
-
+ impl = icalvalue_new_impl(ICAL_X_VALUE);
icalvalue_set_x((icalvalue*)impl,v);
return (icalvalue*)impl;
}
diff --git a/src/plugins/vcalendar/libical/libical/icalmime.c b/src/plugins/vcalendar/libical/libical/icalmime.c
index b784414..f3ba2a2 100644
--- a/src/plugins/vcalendar/libical/libical/icalmime.c
+++ b/src/plugins/vcalendar/libical/libical/icalmime.c
@@ -384,6 +384,8 @@ int icalmime_test(char* (*get_string)(char *s, size_t size, void *d),
printf("%s\n",out);
+ free(out);
+
return 0;
}
diff --git a/src/plugins/vcalendar/libical/libical/icalparameter.c b/src/plugins/vcalendar/libical/libical/icalparameter.c
index 4a04380..c7d6702 100644
--- a/src/plugins/vcalendar/libical/libical/icalparameter.c
+++ b/src/plugins/vcalendar/libical/libical/icalparameter.c
@@ -171,6 +171,7 @@ icalparameter* icalparameter_new_from_string(const char *str)
if(eq == 0){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ free(cpy);
return 0;
}
@@ -182,6 +183,7 @@ icalparameter* icalparameter_new_from_string(const char *str)
if(kind == ICAL_NO_PARAMETER){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ free(cpy);
return 0;
}
@@ -233,6 +235,7 @@ icalparameter_as_ical_string (icalparameter* parameter)
kind_string == 0)
{
icalerror_set_errno(ICAL_BADARG_ERROR);
+ icalmemory_free_buffer(buf);
return 0;
}
@@ -251,13 +254,14 @@ icalparameter_as_ical_string (icalparameter* parameter)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
} else {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ icalmemory_free_buffer(buf);
return 0;
}
/* Now, copy the buffer to a tmp_buffer, which is safe to give to
the caller without worring about de-allocating it. */
- out_buf = icalmemory_tmp_buffer(strlen(buf));
+ out_buf = icalmemory_tmp_buffer(strlen(buf) + 1);
strcpy(out_buf, buf);
icalmemory_free_buffer(buf);
diff --git a/src/plugins/vcalendar/libical/libical/icalproperty.c b/src/plugins/vcalendar/libical/libical/icalproperty.c
index a848a89..855e24b 100644
--- a/src/plugins/vcalendar/libical/libical/icalproperty.c
+++ b/src/plugins/vcalendar/libical/libical/icalproperty.c
@@ -176,14 +176,17 @@ icalproperty* icalproperty_new_from_string(char* str)
{
size_t buf_size = 1024;
- char* buf = icalmemory_new_buffer(buf_size);
- char* buf_ptr = buf;
+ char* buf;
+ char* buf_ptr;
icalproperty *prop;
icalcomponent *comp;
int errors = 0;
icalerror_check_arg_rz( (str!=0),"str");
+ buf = icalmemory_new_buffer(buf_size);
+ buf_ptr = buf;
+
/* Is this a HACK or a crafty reuse of code? */
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:VCALENDAR\n");
@@ -195,6 +198,7 @@ icalproperty* icalproperty_new_from_string(char* str)
if(comp == 0){
icalerror_set_errno(ICAL_PARSE_ERROR);
+ icalmemory_free_buffer(buf);
return 0;
}
@@ -205,7 +209,7 @@ icalproperty* icalproperty_new_from_string(char* str)
icalcomponent_remove_property(comp,prop);
icalcomponent_free(comp);
- free(buf);
+ icalmemory_free_buffer(buf);
if(errors > 0){
icalproperty_free(prop);
@@ -276,8 +280,8 @@ icalproperty_as_ical_string (icalproperty* prop)
const char* property_name = 0;
size_t buf_size = 1024;
- char* buf = icalmemory_new_buffer(buf_size);
- char* buf_ptr = buf;
+ char* buf;
+ char* buf_ptr;
icalvalue* value;
char *out_buf;
@@ -287,6 +291,8 @@ icalproperty_as_ical_string (icalproperty* prop)
icalerror_check_arg_rz( (prop!=0),"prop");
+ buf = icalmemory_new_buffer(buf_size);
+ buf_ptr = buf;
/* Append property name */
@@ -762,7 +768,8 @@ char* icalproperty_get_name (icalproperty* prop)
if (property_name == 0 ) {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
+ icalmemory_free_buffer(buf);
+ return NULL;
} else {
/* _append_string will automatically grow the buffer if
diff --git a/src/plugins/vcalendar/libical/libical/icalrecur.c b/src/plugins/vcalendar/libical/libical/icalrecur.c
index 9c07e79..9d3c96d 100644
--- a/src/plugins/vcalendar/libical/libical/icalrecur.c
+++ b/src/plugins/vcalendar/libical/libical/icalrecur.c
@@ -798,7 +798,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
icalrecur_two_byrule(impl,BY_YEAR_DAY,BY_DAY) ){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
-
+ free(impl);
return 0;
}
@@ -806,8 +806,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
if(icalrecur_two_byrule(impl,BY_WEEK_NO,BY_MONTH)){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
-
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ free(impl);
return 0;
}
@@ -815,8 +814,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
if(icalrecur_two_byrule(impl,BY_WEEK_NO,BY_MONTH_DAY)){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
-
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ free(impl);
return 0;
}
@@ -827,6 +825,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
if(freq == ICAL_MONTHLY_RECURRENCE &&
icalrecur_one_byrule(impl,BY_WEEK_NO)){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ free(impl);
return 0;
}
@@ -837,6 +836,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
if(freq == ICAL_WEEKLY_RECURRENCE &&
icalrecur_one_byrule(impl,BY_MONTH_DAY )) {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ free(impl);
return 0;
}
@@ -844,6 +844,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
if(freq != ICAL_YEARLY_RECURRENCE &&
icalrecur_one_byrule(impl,BY_YEAR_DAY )) {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ free(impl);
return 0;
}
@@ -957,13 +958,12 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
if(impl->last.day > days_in_month || impl->last.day == 0){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ free(impl);
return 0;
}
}
-
-
return impl;
}
@@ -1787,7 +1787,7 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
short day = (short)GPOINTER_TO_INT(pvl_data(i));
impl->days[days_index++] = day;
}
-
+ pvl_free(days);
break;
}
@@ -1857,8 +1857,8 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
}
}
}
-
}
+ pvl_free(days);
break;
@@ -1887,6 +1887,7 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
}
}
+ pvl_free(days);
break;
}
diff --git a/src/plugins/vcalendar/libical/libical/icaltime.c b/src/plugins/vcalendar/libical/libical/icaltime.c
index b1a3b98..6532ff2 100644
--- a/src/plugins/vcalendar/libical/libical/icaltime.c
+++ b/src/plugins/vcalendar/libical/libical/icaltime.c
@@ -108,6 +108,7 @@ struct set_tz_save set_tz(const char* tzid)
if(new_env_str == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ free(orig_tzid);
return savetz;
}
diff --git a/src/plugins/vcalendar/libical/libical/icalvalue.c b/src/plugins/vcalendar/libical/libical/icalvalue.c
index 9306514..950ec02 100644
--- a/src/plugins/vcalendar/libical/libical/icalvalue.c
+++ b/src/plugins/vcalendar/libical/libical/icalvalue.c
@@ -123,6 +123,7 @@ icalvalue* icalvalue_new_clone(icalvalue* value){
new->data.v_string=icalmemory_strdup(old->data.v_string);
if ( new->data.v_string == 0 ) {
+ icalvalue_free(new);
return 0;
}
@@ -135,6 +136,7 @@ icalvalue* icalvalue_new_clone(icalvalue* value){
new->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
if(new->data.v_recur == 0){
+ icalvalue_free(new);
return 0;
}
diff --git a/src/plugins/vcalendar/libical/libical/sspm.c b/src/plugins/vcalendar/libical/libical/sspm.c
index 731a5d5..84e71a9 100644
--- a/src/plugins/vcalendar/libical/libical/sspm.c
+++ b/src/plugins/vcalendar/libical/libical/sspm.c
@@ -419,12 +419,14 @@ struct sspm_action_map get_action(struct mime_impl *impl,
char* sspm_lowercase(char* str)
{
char* p = 0;
- char* new = sspm_strdup(str);
+ char* new;
if(str ==0){
return 0;
}
+ new = sspm_strdup(str);
+
for(p = new; *p!=0; p++){
*p = tolower(*p);
}
@@ -457,6 +459,7 @@ enum sspm_minor_type sspm_find_minor_content_type(char* type)
char *p = strchr(ltype,'/');
if (p==0){
+ free(ltype);
return SSPM_UNKNOWN_MINOR_TYPE;
}
diff --git a/src/plugins/vcalendar/libical/scripts/mkderivedproperties.pl b/src/plugins/vcalendar/libical/scripts/mkderivedproperties.pl
index 4e011e1..6fd4387 100644
--- a/src/plugins/vcalendar/libical/scripts/mkderivedproperties.pl
+++ b/src/plugins/vcalendar/libical/scripts/mkderivedproperties.pl
@@ -166,13 +166,17 @@ foreach $prop (sort keys %propmap) {
print<<EOM;
/* $prop */
icalproperty* icalproperty_new_${lc}($type v) {
- struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY); $pointer_check
+ struct icalproperty_impl *impl;
+ $pointer_check
+ impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY);
icalproperty_set_${lc}((icalproperty*)impl,v);
return (icalproperty*)impl;
}
icalproperty* icalproperty_vanew_${lc}($type v, ...){
va_list args;
- struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY); $pointer_check
+ struct icalproperty_impl *impl;
+ $pointer_check
+ impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY);
icalproperty_set_${lc}((icalproperty*)impl,v);
va_start(args,v);
icalproperty_add_parameters(impl, args);
diff --git a/src/plugins/vcalendar/libical/scripts/mkderivedvalues.pl b/src/plugins/vcalendar/libical/scripts/mkderivedvalues.pl
index e08d3b2..88a37fd 100644
--- a/src/plugins/vcalendar/libical/scripts/mkderivedvalues.pl
+++ b/src/plugins/vcalendar/libical/scripts/mkderivedvalues.pl
@@ -176,8 +176,9 @@ foreach $value (keys %h) {
print "\n\n\
icalvalue* icalvalue_new_${lc} ($type v){\
- struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_${uc}_VALUE);\
+ struct icalvalue_impl* impl;\
$pointer_check\
+ impl = icalvalue_new_impl(ICAL_${uc}_VALUE);\
icalvalue_set_${lc}((icalvalue*)impl,v);\
return (icalvalue*)impl;\
}\
commit 49d9491bae0b3534083a5190de3250da3040f36d
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 10:49:25 2015 +0100
More null pointer dereference fixes
diff --git a/src/plugins/archive/libarchive_archive.c b/src/plugins/archive/libarchive_archive.c
index f0ae67b..ddedbda 100644
--- a/src/plugins/archive/libarchive_archive.c
+++ b/src/plugins/archive/libarchive_archive.c
@@ -157,10 +157,10 @@ static GDate* iso2GDate(const gchar* date) {
gdate = g_date_new();
parts = g_strsplit(date, "-", 3);
- if (! is_iso_string(parts))
- return NULL;
if (!parts)
return NULL;
+ if (! is_iso_string(parts))
+ return NULL;
for (i = 0; i < 3; i++) {
int t = atoi(parts[i]);
switch (i) {
diff --git a/src/plugins/managesieve/managesieve.c b/src/plugins/managesieve/managesieve.c
index f0159e7..9739a0e 100644
--- a/src/plugins/managesieve/managesieve.c
+++ b/src/plugins/managesieve/managesieve.c
@@ -620,7 +620,7 @@ static void parse_response(gchar *msg, SieveResult *result)
}
/* response code */
- if (msg[0] == '(' && (end = strchr(msg, ')'))) {
+ if (msg && msg[0] == '(' && (end = strchr(msg, ')'))) {
msg++;
*end++ = '\0';
result->code =
@@ -635,7 +635,7 @@ static void parse_response(gchar *msg, SieveResult *result)
}
/* s2c octets */
- if (msg[0] == '{' && (end = strchr(msg, '}'))) {
+ if (msg && msg[0] == '{' && (end = strchr(msg, '}'))) {
msg++;
*end++ = '\0';
if (msg[0] == '0' && msg+1 == end) {
@@ -654,7 +654,7 @@ static void parse_response(gchar *msg, SieveResult *result)
}
/* text */
- if (*msg) {
+ if (msg && *msg) {
unquote_inplace(msg);
result->description = msg;
} else {
diff --git a/src/plugins/pdf_viewer/poppler_viewer.c b/src/plugins/pdf_viewer/poppler_viewer.c
index eee0cb6..a0cecaf 100644
--- a/src/plugins/pdf_viewer/poppler_viewer.c
+++ b/src/plugins/pdf_viewer/poppler_viewer.c
@@ -1486,7 +1486,8 @@ static void pdf_viewer_show_mimepart(MimeViewer *_viewer, const gchar *infile,
pdf_viewer_update((MimeViewer *)viewer, TRUE, 1);
- messageview->updating = FALSE;
+ if (messageview)
+ messageview->updating = FALSE;
}
static void pdf_viewer_clear(MimeViewer *_viewer)
diff --git a/src/plugins/pgpcore/select-keys.c b/src/plugins/pgpcore/select-keys.c
index 6559220..9abac75 100644
--- a/src/plugins/pgpcore/select-keys.c
+++ b/src/plugins/pgpcore/select-keys.c
@@ -275,7 +275,7 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot
clist = sk->clist;
cm_return_val_if_fail (clist, NULL);
- debug_print ("select_keys:fill_clist: pattern '%s' proto %d\n", pattern, proto);
+ debug_print ("select_keys:fill_clist: pattern '%s' proto %d\n", pattern != NULL ? pattern : "NULL", proto);
/*gtk_cmclist_freeze (select_keys.clist);*/
err = gpgme_new (&ctx);
@@ -291,7 +291,7 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot
err = gpgme_op_keylist_start (ctx, pattern, 0);
if (err) {
debug_print ("** gpgme_op_keylist_start(%s) failed: %s",
- pattern, gpgme_strerror (err));
+ pattern != NULL ? pattern : "NULL", gpgme_strerror (err));
sk->select_ctx = NULL;
gpgme_release(ctx);
return NULL;
@@ -312,7 +312,7 @@ fill_clist (struct select_keys_s *sk, const char *pattern, gpgme_protocol_t prot
continue;
raw_mail = g_strdup(uid->email);
extract_address(raw_mail);
- if (!strcasecmp(pattern, raw_mail)) {
+ if (pattern != NULL && !strcasecmp(pattern, raw_mail)) {
exact_match = TRUE;
last_uid = uid;
g_free(raw_mail);
diff --git a/src/plugins/pgpcore/sgpgme.c b/src/plugins/pgpcore/sgpgme.c
index 6730078..5d0ecac 100644
--- a/src/plugins/pgpcore/sgpgme.c
+++ b/src/plugins/pgpcore/sgpgme.c
@@ -325,7 +325,7 @@ gchar *sgpgme_sigstat_info_full(gpgme_ctx_t ctx, gpgme_verify_result_t status)
case GPG_ERR_NO_ERROR:
g_string_append_printf(siginfo,
_("Good signature from uid \"%s\" (Validity: %s)\n"),
- uid, get_validity_str(key->uids?key->uids->validity:GPGME_VALIDITY_UNKNOWN));
+ uid, get_validity_str((key && key->uids) ? key->uids->validity:GPGME_VALIDITY_UNKNOWN));
break;
case GPG_ERR_KEY_EXPIRED:
g_string_append_printf(siginfo,
@@ -335,7 +335,7 @@ gchar *sgpgme_sigstat_info_full(gpgme_ctx_t ctx, gpgme_verify_result_t status)
case GPG_ERR_SIG_EXPIRED:
g_string_append_printf(siginfo,
_("Expired signature from uid \"%s\" (Validity: %s)\n"),
- uid, get_validity_str(key->uids?key->uids->validity:GPGME_VALIDITY_UNKNOWN));
+ uid, get_validity_str((key && key->uids) ? key->uids->validity:GPGME_VALIDITY_UNKNOWN));
break;
case GPG_ERR_CERT_REVOKED:
g_string_append_printf(siginfo,
@@ -352,17 +352,19 @@ gchar *sgpgme_sigstat_info_full(gpgme_ctx_t ctx, gpgme_verify_result_t status)
}
if (sig->status != GPG_ERR_BAD_SIGNATURE) {
gint j = 1;
- key->uids = key->uids ? key->uids->next : NULL;
- while (key->uids != NULL) {
- g_string_append_printf(siginfo,
- _(" uid \"%s\" (Validity: %s)\n"),
- key->uids->uid,
- key->uids->revoked==TRUE?_("Revoked"):get_validity_str(key->uids->validity));
- j++;
- key->uids = key->uids->next;
+ if (key) {
+ key->uids = key->uids ? key->uids->next : NULL;
+ while (key->uids != NULL) {
+ g_string_append_printf(siginfo,
+ _(" uid \"%s\" (Validity: %s)\n"),
+ key->uids->uid,
+ key->uids->revoked==TRUE?_("Revoked"):get_validity_str(key->uids->validity));
+ j++;
+ key->uids = key->uids->next;
+ }
}
g_string_append_printf(siginfo,_("Owner Trust: %s\n"),
- get_owner_trust_str(key->owner_trust));
+ key ? get_owner_trust_str(key->owner_trust) : _("No key!"));
g_string_append(siginfo,
_("Primary key fingerprint:"));
const char* primary_fpr = NULL;
diff --git a/src/plugins/python/python-hooks.c b/src/plugins/python/python-hooks.c
index 4cd1cb5..e4e464f 100644
--- a/src/plugins/python/python-hooks.c
+++ b/src/plugins/python/python-hooks.c
@@ -275,8 +275,10 @@ parasite_python_run(const char *command,
if (repr != NULL) {
char *string = PyString_AsString(repr);
- stdout_logger(string, user_data);
- stdout_logger("\n", user_data);
+ if (stdout_logger != NULL) {
+ stdout_logger(string, user_data);
+ stdout_logger("\n", user_data);
+ }
}
Py_XDECREF(repr);
diff --git a/src/plugins/rssyl/libfeed/parser_atom10.c b/src/plugins/rssyl/libfeed/parser_atom10.c
index eda6064..f2afa3f 100644
--- a/src/plugins/rssyl/libfeed/parser_atom10.c
+++ b/src/plugins/rssyl/libfeed/parser_atom10.c
@@ -83,12 +83,12 @@ void feed_parser_atom10_start(void *data, const gchar *el, const gchar **attr)
} else if( !strcmp(el, "link") ) {
/* Capture item URL, from the "url" XML attribute. */
if (ctx->curitem && ctx->location == FEED_LOC_ATOM10_ENTRY)
- ctx->curitem->url = g_strdup(feed_parser_get_attribute_value(attr, "href"));
+ ctx->curitem->url = g_strdup(feed_parser_get_attribute_value(attr, "href"));
} else if( !strcmp(el, "source") ) {
ctx->location = FEED_LOC_ATOM10_SOURCE;
} else ctx->location = FEED_LOC_ATOM10_ENTRY;
- if( !strcmp(el, "title") ) {
+ if( !strcmp(el, "title") && ctx->curitem != NULL) {
a = feed_parser_get_attribute_value(attr, "type");
if( !a || !strcmp(a, "text") )
ctx->curitem->title_format = FEED_ITEM_TITLE_TEXT;
@@ -98,7 +98,7 @@ void feed_parser_atom10_start(void *data, const gchar *el, const gchar **attr)
ctx->curitem->title_format = FEED_ITEM_TITLE_XHTML;
else
ctx->curitem->title_format = FEED_ITEM_TITLE_UNKNOWN;
- } else if (!strcmp(el, "content") ) {
+ } else if (!strcmp(el, "content") && ctx->curitem != NULL) {
a = feed_parser_get_attribute_value(attr, "type");
if (a && !strcmp(a, "xhtml")) {
ctx->curitem->xhtml_content = TRUE;
commit 24e8816b793686174e1eca453350d9e613d13e56
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 10:29:56 2015 +0100
Fix null pointer dereference
diff --git a/src/plugins/mailmbox/mmapstring.c b/src/plugins/mailmbox/mmapstring.c
index 2bf3582..2a70e5e 100644
--- a/src/plugins/mailmbox/mmapstring.c
+++ b/src/plugins/mailmbox/mmapstring.c
@@ -303,7 +303,10 @@ mmap_string_sized_new (size_t dfl_size)
if (mmap_string_maybe_expand (string, MAX (dfl_size, 2)) == NULL)
return NULL;
- string->str[0] = 0;
+ if (string->str == NULL)
+ return NULL;
+
+ string->str[0] = '\0';
return string;
}
commit de770e4c9c5cc1a3f29b7902d1367e71308b81f9
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 10:28:05 2015 +0100
Fix null pointer dereference
diff --git a/src/plugins/vcalendar/libical/libical/icalmime.c b/src/plugins/vcalendar/libical/libical/icalmime.c
index 2ed9bac..b784414 100644
--- a/src/plugins/vcalendar/libical/libical/icalmime.c
+++ b/src/plugins/vcalendar/libical/libical/icalmime.c
@@ -167,7 +167,7 @@ icalcomponent* icalmime_parse(char* (*get_string)(char *s, size_t size,
{
struct sspm_part *parts;
int i, last_level=0;
- icalcomponent *root=0, *parent=0, *comp=0, *last = 0;
+ icalcomponent *root = NULL, *parent = NULL, *comp = NULL, *last = NULL;
size_t alloc_len = NUM_PARTS * sizeof(struct sspm_part);
if ( (parts = (struct sspm_part *)
@@ -309,7 +309,7 @@ line between the header and the previous boundary\?";
}
if(parts[i].level == last_level && last_level != 0){
- icalerror_assert(parent!=0,"No parent for adding component");
+ icalerror_assert(parent != NULL, "No parent for adding component");
icalcomponent_add_component(parent,comp);
@@ -327,7 +327,7 @@ line between the header and the previous boundary\?";
last_level = parts[i].level;
} else if (parts[i].level < last_level){
-
+ icalerror_assert(parent != NULL, "No parent");
parent = icalcomponent_get_parent(parent);
icalcomponent_add_component(parent,comp);
commit 416fbdb5fa8c9a49d3b982b16b833419b3412a5e
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 10:23:01 2015 +0100
Remove stupid function
diff --git a/src/plugins/vcalendar/libical/libical/icalerror.c b/src/plugins/vcalendar/libical/libical/icalerror.c
index c1fecf4..bfcbaaf 100644
--- a/src/plugins/vcalendar/libical/libical/icalerror.c
+++ b/src/plugins/vcalendar/libical/libical/icalerror.c
@@ -40,15 +40,6 @@ void icalerror_stop_here(void)
foo++; /* Keep optimizers from removing routine */
}
-void icalerror_crash_here(void)
-{
- int *p=0;
- *p = 1;
-
- assert( *p);
-}
-
-
void icalerror_clear_errno() {
icalerrno = ICAL_NO_ERROR;
diff --git a/src/plugins/vcalendar/libical/libical/icalerror.h b/src/plugins/vcalendar/libical/libical/icalerror.h
index 790fa90..1f521c6 100644
--- a/src/plugins/vcalendar/libical/libical/icalerror.h
+++ b/src/plugins/vcalendar/libical/libical/icalerror.h
@@ -41,8 +41,6 @@
below */
void icalerror_stop_here(void);
-void icalerror_crash_here(void);
-
typedef enum icalerrorenum {
ICAL_BADARG_ERROR,
commit 24f49cb6a765ec9d6b6f53dc60239e9cc7c0d091
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 10:21:02 2015 +0100
Fix null pointer dereference
diff --git a/src/plugins/mailmbox/plugin_gtk.c b/src/plugins/mailmbox/plugin_gtk.c
index 75de2f2..16ea162 100644
--- a/src/plugins/mailmbox/plugin_gtk.c
+++ b/src/plugins/mailmbox/plugin_gtk.c
@@ -146,16 +146,16 @@ static void set_sensitivity(GtkUIManager *ui_manager, FolderItem *item)
#define SET_SENS(name, sens) \
cm_menu_set_sensitive_full(ui_manager, "Popup/"name, sens)
- SET_SENS("FolderViewPopup/CreateNewFolder", item->stype != F_INBOX);
- SET_SENS("FolderViewPopup/RenameFolder", item->stype == F_NORMAL && folder_item_parent(item) != NULL);
- SET_SENS("FolderViewPopup/MoveFolder", folder_is_normal && folder_item_parent(item) != NULL);
- SET_SENS("FolderViewPopup/DeleteFolder", item->stype == F_NORMAL && folder_item_parent(item) != NULL);
+ SET_SENS("FolderViewPopup/CreateNewFolder", item && item->stype != F_INBOX);
+ SET_SENS("FolderViewPopup/RenameFolder", item && item->stype == F_NORMAL && folder_item_parent(item) != NULL);
+ SET_SENS("FolderViewPopup/MoveFolder", folder_is_normal && folder_item_parent(item) != NULL);
+ SET_SENS("FolderViewPopup/DeleteFolder", item && item->stype == F_NORMAL && folder_item_parent(item) != NULL);
- SET_SENS("FolderViewPopup/CheckNewMessages", folder_item_parent(item) == NULL);
- SET_SENS("FolderViewPopup/CheckNewFolders", folder_item_parent(item) == NULL);
- SET_SENS("FolderViewPopup/RebuildTree", folder_item_parent(item) == NULL);
+ SET_SENS("FolderViewPopup/CheckNewMessages", folder_item_parent(item) == NULL);
+ SET_SENS("FolderViewPopup/CheckNewFolders", folder_item_parent(item) == NULL);
+ SET_SENS("FolderViewPopup/RebuildTree", folder_item_parent(item) == NULL);
- SET_SENS("FolderViewPopup/RemoveMailbox", folder_item_parent(item) == NULL);
+ SET_SENS("FolderViewPopup/RemoveMailbox", folder_item_parent(item) == NULL);
#undef SET_SENS
}
commit d7e8f002018245de9443feb1ad88ce9c176dfef0
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 10:17:25 2015 +0100
Fix overflow
diff --git a/src/plugins/mailmbox/mailmbox_types.c b/src/plugins/mailmbox/mailmbox_types.c
index 0605a89..8495d8c 100644
--- a/src/plugins/mailmbox/mailmbox_types.c
+++ b/src/plugins/mailmbox/mailmbox_types.c
@@ -192,8 +192,8 @@ struct claws_mailmbox_folder * claws_mailmbox_folder_new(const char * mb_filenam
if (folder == NULL)
goto err;
- strncpy(folder->mb_filename, mb_filename, PATH_MAX);
-
+ strncpy(folder->mb_filename, mb_filename, PATH_MAX - 1);
+ folder->mb_filename[PATH_MAX - 1] = '\0';
folder->mb_mtime = (time_t) -1;
folder->mb_fd = -1;
commit 90028bb20a5fa177f5048f71c8d9499202f2be0c
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 10:17:19 2015 +0100
Fix overflow
diff --git a/src/plugins/clamd/libclamd/clamd-plugin.c b/src/plugins/clamd/libclamd/clamd-plugin.c
index d2e725a..10bec44 100644
--- a/src/plugins/clamd/libclamd/clamd-plugin.c
+++ b/src/plugins/clamd/libclamd/clamd-plugin.c
@@ -388,7 +388,7 @@ Clamd_Stat clamd_init(Clamd_Socket* config) {
return NO_CONNECTION;
}
memset(buf, '\0', sizeof(buf));
- while ((n_read = read(sock, buf, sizeof(buf))) > 0) {
+ while ((n_read = read(sock, buf, BUFSIZ - 1)) > 0) {
buf[n_read] = '\0';
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
@@ -574,7 +574,7 @@ GSList* clamd_verify_dir(const gchar* path) {
}
g_free(command);
memset(buf, '\0', sizeof(buf));
- while ((n_read = read(sock, buf, BUFSIZ)) > 0) {
+ while ((n_read = read(sock, buf, BUFSIZ - 1)) > 0) {
gchar** tmp = g_strsplit(buf, "\n", 0);
gchar** head = tmp;
while (*tmp) {
commit d552194e1b9992e8c2aac4974b5831f1c2fa7c70
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 10:15:21 2015 +0100
Fix overflow
diff --git a/src/plugins/notification/notification_core.c b/src/plugins/notification/notification_core.c
index 22fb659..69bdf31 100644
--- a/src/plugins/notification/notification_core.c
+++ b/src/plugins/notification/notification_core.c
@@ -653,22 +653,22 @@ gchar* notification_libnotify_sanitize_str(gchar *in)
i_out = 0;
while(*in) {
if(*in == '<') {
- if(i_out+3 > STR_MAX_LEN) break;
+ if(i_out+3 >= STR_MAX_LEN) break;
memcpy(&(tmp_str[i_out]),"<",4);
in++; i_out += 4;
}
else if(*in == '>') {
- if(i_out+3 > STR_MAX_LEN) break;
+ if(i_out+3 >= STR_MAX_LEN) break;
memcpy(&(tmp_str[i_out]),">",4);
in++; i_out += 4;
}
else if(*in == '&') {
- if(i_out+4 > STR_MAX_LEN) break;
+ if(i_out+4 >= STR_MAX_LEN) break;
memcpy(&(tmp_str[i_out]),"&",5);
in++; i_out += 5;
}
else {
- if(i_out > STR_MAX_LEN) break;
+ if(i_out >= STR_MAX_LEN) break;
tmp_str[i_out++] = *in++;
}
}
commit 53b36de8db2ed7d8b60d37afc544393e9cb603cd
Author: Colin Leroy <colin at colino.net>
Date: Fri Nov 13 09:46:16 2015 +0100
Better fix for buffer overrun
diff --git a/src/plugins/clamd/libclamd/clamd-plugin.c b/src/plugins/clamd/libclamd/clamd-plugin.c
index dd61481..d2e725a 100644
--- a/src/plugins/clamd/libclamd/clamd-plugin.c
+++ b/src/plugins/clamd/libclamd/clamd-plugin.c
@@ -368,8 +368,7 @@ Clamd_Stat clamd_init(Clamd_Socket* config) {
return NO_CONNECTION;
}
memset(buf, '\0', sizeof(buf));
- while ((n_read = read(sock, buf, BUFSIZ)) > 0) {
- n_read = n_read < BUFSIZ ? n_read : BUFSIZ - 1;
+ while ((n_read = read(sock, buf, BUFSIZ - 1)) > 0) {
buf[n_read] = '\0';
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
@@ -526,8 +525,7 @@ Clamd_Stat clamd_verify_email(const gchar* path, response* result) {
}
g_free(command);
memset(buf, '\0', sizeof(buf));
- while ((n_read = read(sock, buf, BUFSIZ)) > 0) {
- n_read = n_read < BUFSIZ ? n_read : BUFSIZ - 1;
+ while ((n_read = read(sock, buf, BUFSIZ - 1)) > 0) {
buf[n_read] = '\0';
if (buf[strlen(buf) - 1] == '\n')
buf[strlen(buf) - 1] = '\0';
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list