[Commits] [SCM] claws branch, master, updated. 3.18.0-67-g5ad4679e5

wwp at claws-mail.org wwp at claws-mail.org
Fri Sep 3 07:33:58 UTC 2021


The branch, master has been updated
       via  5ad4679e5bab182ade2b3628b3e41608a5af4522 (commit)
      from  05f600e5826ab4fd43e345b87bf1029c1fef48f7 (commit)

Summary of changes:
 src/plugins/bogofilter/bogofilter.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 5ad4679e5bab182ade2b3628b3e41608a5af4522
Author: wwp <subscript at free.fr>
Date:   Fri Sep 3 09:32:46 2021 +0200

    CID1440023: use the number of bytes read() from bogofilter's stdout.

diff --git a/src/plugins/bogofilter/bogofilter.c b/src/plugins/bogofilter/bogofilter.c
index ffd620acb..66d156ceb 100644
--- a/src/plugins/bogofilter/bogofilter.c
+++ b/src/plugins/bogofilter/bogofilter.c
@@ -208,6 +208,7 @@ static void bogofilter_do_filter(BogoFilterData *data)
 		for (cur = data->msglist; cur; cur = cur->next) {
 			gboolean whitelisted = FALSE;
 			msginfo = (MsgInfo *)cur->data;
+			ssize_t n_read;
 			debug_print("Filtering message %d (%d/%d)\n", msginfo->msgnum, curnum, total);
 
 			if (message_callback != NULL)
@@ -229,7 +230,7 @@ static void bogofilter_do_filter(BogoFilterData *data)
 				g_free(tmp);
 				memset(buf, 0, sizeof(buf));
 				/* get the result */
-				if (read(bogo_stdout, buf, sizeof(buf)-1) < 0) {
+				if (n_read = read(bogo_stdout, buf, sizeof(buf)-1) < 0) {
 					g_warning("bogofilter short read");
 					debug_print("message %d is ham\n", msginfo->msgnum);
 					data->mail_filtering_data->unfiltered = g_slist_prepend(
@@ -238,14 +239,14 @@ static void bogofilter_do_filter(BogoFilterData *data)
 				} else {
 					gchar **parts = NULL;
 
-					buf[sizeof(buf) - 1] = '\0';
+					buf[n_read] = '\0';
 					if (strchr(buf, '/')) {
 						tmp = strrchr(buf, '/')+1;
 					} else {
 						tmp = buf;
 					}
 					parts = g_strsplit(tmp, " ", 0);
-					debug_print("read %s\n", buf);
+					debug_print("read '%s' (%ld bytes)\n", buf, n_read);
 					
 					/* note the result if the header if needed */
 					if (parts && parts[0] && parts[1] && parts[2] && 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list