[Commits] [SCM] claws branch, master, updated. 3.14.1-107-ge3cd98f

wwp at claws-mail.org wwp at claws-mail.org
Tue Jan 10 09:27:22 CET 2017


The branch, master has been updated
       via  e3cd98f9f35659223f166886529e5e8a679390a1 (commit)
      from  d18fa867290823fc182efbfa7bec5caf46205008 (commit)

Summary of changes:
 src/plugins/notification/notification_core.c |   28 +++++++++++++-------------
 1 file changed, 14 insertions(+), 14 deletions(-)


- Log -----------------------------------------------------------------
commit e3cd98f9f35659223f166886529e5e8a679390a1
Author: wwp <wwp at free.fr>
Date:   Tue Jan 10 09:26:08 2017 +0100

    Better fix for Coverity #1220388, use effective indexes and boundaries.

diff --git a/src/plugins/notification/notification_core.c b/src/plugins/notification/notification_core.c
index 22fb659..1736523 100644
--- a/src/plugins/notification/notification_core.c
+++ b/src/plugins/notification/notification_core.c
@@ -645,34 +645,34 @@ void notification_show_mainwindow(MainWindow *mainwin)
 /* Returns a newly allocated string which needs to be freed */
 gchar* notification_libnotify_sanitize_str(gchar *in)
 {
-  gint i_out;
+  gint out;
   gchar tmp_str[STR_MAX_LEN+1];
 
   if(in == NULL) return NULL;
 
-  i_out = 0;
+  out = 0;
   while(*in) {
     if(*in == '<') {
-      if(i_out+3 > STR_MAX_LEN) break;
-      memcpy(&(tmp_str[i_out]),"<",4);
-      in++; i_out += 4;
+      if(out+4 > STR_MAX_LEN+1) break;
+      memcpy(&(tmp_str[out]),"<",4);
+      in++; out += 4;
     }
     else if(*in == '>') {
-      if(i_out+3 > STR_MAX_LEN) break;
-      memcpy(&(tmp_str[i_out]),">",4);
-      in++; i_out += 4;
+      if(out+4 > STR_MAX_LEN+1) break;
+      memcpy(&(tmp_str[out]),">",4);
+      in++; out += 4;
     }
     else if(*in == '&') {
-      if(i_out+4 > STR_MAX_LEN) break;
-      memcpy(&(tmp_str[i_out]),"&",5);
-      in++; i_out += 5;
+      if(out+5 > STR_MAX_LEN+1) break;
+      memcpy(&(tmp_str[out]),"&",5);
+      in++; out += 5;
     }
     else {
-      if(i_out > STR_MAX_LEN) break;
-      tmp_str[i_out++] = *in++;
+      if(out+1 > STR_MAX_LEN+1) break;
+      tmp_str[out++] = *in++;
     }
   }
-  tmp_str[i_out] = '\0';
+  tmp_str[out] = '\0';
   return strdup(tmp_str);
 }
 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list