[Commits] [SCM] claws branch, master, updated. 3.14.1-111-g619164a

wwp at claws-mail.org wwp at claws-mail.org
Tue Jan 10 10:10:48 CET 2017


The branch, master has been updated
       via  619164ab297cda7c6a209f6b833dac4b52861929 (commit)
       via  16b5db8d3a4073b18193e0ed82f73d74c57b0fb2 (commit)
      from  37b65a4db70b26267deb1842081f7b64df15de55 (commit)

Summary of changes:
 src/plugins/archive/libarchive_archive.c |   55 ++++++++++++++++--------------
 src/plugins/managesieve/managesieve.c    |   10 +++---
 src/plugins/python/clawsmailmodule.c     |    3 +-
 src/plugins/python/python-shell.c        |    2 +-
 4 files changed, 38 insertions(+), 32 deletions(-)


- Log -----------------------------------------------------------------
commit 619164ab297cda7c6a209f6b833dac4b52861929
Author: wwp <wwp at free.fr>
Date:   Tue Jan 10 10:10:05 2017 +0100

    Fix Coverity CIDs: 1220259 1364687 (and discarded 1220496) and added more checks for returned
    values.

diff --git a/src/plugins/archive/libarchive_archive.c b/src/plugins/archive/libarchive_archive.c
index 7aa9595..a348c54 100644
--- a/src/plugins/archive/libarchive_archive.c
+++ b/src/plugins/archive/libarchive_archive.c
@@ -591,34 +591,37 @@ const gchar* archive_create(const char* archive_name, GSList* files,
 				perror("open file");
 			}
 			else {
-				lstat(filename, &st);
-				archive_entry_copy_stat(entry, &st);
-				archive_entry_set_pathname(entry, filename);
-				if (S_ISLNK(st.st_mode)) {
-					buf = NULL;
-					buf = malloc(PATH_MAX + 1);
-					if ((len = readlink(filename, buf, PATH_MAX)) < 0)
-						perror("error in readlink");
-					else
-						buf[len] = '\0';
-					archive_entry_set_symlink(entry, buf);
-					g_free(buf);
-					archive_entry_set_size(entry, 0);
-					archive_write_header(arch, entry);
-				}
-				else {
-					if (archive_write_header(arch, entry) != ARCHIVE_OK)
-						g_warning("%s", archive_error_string(arch));
-					buf = NULL;
-					buf = malloc(READ_BLOCK_SIZE);
-					len = read(fd, buf, READ_BLOCK_SIZE);
-					while (len > 0) {
-						if (archive_write_data(arch, buf, len) == -1)
+				if (lstat(filename, &st) == -1) {
+					perror("lstat file");
+				} else {
+					archive_entry_copy_stat(entry, &st);
+					archive_entry_set_pathname(entry, filename);
+					if (S_ISLNK(st.st_mode)) {
+						if ((buf = malloc(PATH_MAX + 1)) != NULL) {
+							if ((len = readlink(filename, buf, PATH_MAX)) < 0)
+								perror("error in readlink");
+							else
+								buf[len] = '\0';
+							archive_entry_set_symlink(entry, buf);
+							g_free(buf);
+							archive_entry_set_size(entry, 0);
+							archive_write_header(arch, entry);
+						}
+					}
+					else {
+						if (archive_write_header(arch, entry) != ARCHIVE_OK)
 							g_warning("%s", archive_error_string(arch));
-						memset(buf, 0, READ_BLOCK_SIZE);
-						len = read(fd, buf, READ_BLOCK_SIZE);
+						if ((buf = malloc(READ_BLOCK_SIZE)) != NULL) {
+							len = read(fd, buf, READ_BLOCK_SIZE);
+							while (len > 0) {
+								if (archive_write_data(arch, buf, len) == -1)
+									g_warning("%s", archive_error_string(arch));
+								memset(buf, 0, READ_BLOCK_SIZE);
+								len = read(fd, buf, READ_BLOCK_SIZE);
+							}
+							g_free(buf);
+						}
 					}
-					g_free(buf);
 				}
 				close(fd);
 				archive_entry_free(entry);
diff --git a/src/plugins/managesieve/managesieve.c b/src/plugins/managesieve/managesieve.c
index c839f73..e7b53f5 100644
--- a/src/plugins/managesieve/managesieve.c
+++ b/src/plugins/managesieve/managesieve.c
@@ -690,9 +690,10 @@ static gint sieve_session_recv_msg(Session *session, const gchar *msg)
 			if (sieve_session->tls_init_done == FALSE &&
 					sieve_session->config->tls_type != SIEVE_TLS_NO) {
 				if (sieve_session->capability.starttls) {
-					log_print(LOG_PROTOCOL, "Sieve> STARTTLS\n");
-					session_send_msg(session, "STARTTLS");
-					sieve_session->state = SIEVE_STARTTLS;
+					if (session_send_msg(session, "STARTTLS") < 0)
+						sieve_session->state = SIEVE_ERROR;
+					else
+						sieve_session->state = SIEVE_STARTTLS;
 				} else if (sieve_session->config->tls_type == SIEVE_TLS_YES) {
 					log_warning(LOG_PROTOCOL, "Sieve: does not support STARTTLS\n");
 					sieve_session->state = SIEVE_ERROR;
@@ -1146,7 +1147,8 @@ static void sieve_queue_send(SieveSession *session, SieveState next_state,
 		session->state = next_state;
 		log_send(session, cmd);
 		if (session_send_msg(SESSION(session), cmd->msg) < 0) {
-			/* error */
+			log_warning(LOG_PROTOCOL,
+				_("sending error on Sieve session: %s\n"), cmd->msg);
 		}
 	}
 }

commit 16b5db8d3a4073b18193e0ed82f73d74c57b0fb2
Author: wwp <wwp at free.fr>
Date:   Tue Jan 10 09:59:52 2017 +0100

    Fix Coverity CIDs: 1220274 and 1220377.

diff --git a/src/plugins/python/clawsmailmodule.c b/src/plugins/python/clawsmailmodule.c
index 5ce3b95..aa472e0 100644
--- a/src/plugins/python/clawsmailmodule.c
+++ b/src/plugins/python/clawsmailmodule.c
@@ -920,7 +920,8 @@ PyMODINIT_FUNC initclawsmail(void)
 
   /* add module member "compose_window" set to None */
   Py_INCREF(Py_None);
-  PyModule_AddObject(cm_module, "compose_window", Py_None);
+  if (PyModule_AddObject(cm_module, "compose_window", Py_None) == -1)
+	  debug_print("Error: Could not add object 'compose_window'\n");
 
   /* initialize classes */
   ok = ok && cmpy_add_node(cm_module);
diff --git a/src/plugins/python/python-shell.c b/src/plugins/python/python-shell.c
index 6d2f06d..4ecd3c9 100644
--- a/src/plugins/python/python-shell.c
+++ b/src/plugins/python/python-shell.c
@@ -210,7 +210,7 @@ parasite_python_shell_process_line(GtkWidget *python_shell)
             g_free(g_queue_pop_tail(priv->history));
     }
 
-    last_char = command[MAX(0, strlen(command) - 1)];
+    last_char = command[MAX(0, (gint)(strlen(command) - 1))];
 
     if (last_char == ':' || last_char == '\\' ||
         (priv->in_block && g_ascii_isspace(command[0])))

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list