[Commits] [SCM] claws branch, master, updated. 3.14.1-128-g498b61c

wwp at claws-mail.org wwp at claws-mail.org
Fri Jan 13 09:21:11 CET 2017


The branch, master has been updated
       via  498b61cc586e6e258fb9299d14b49ec831ccb0f8 (commit)
      from  a875f48b7d47a10c29acc8775cd127f61b42b265 (commit)

Summary of changes:
 src/compose.c                                        |   14 +++++++-------
 src/crash.c                                          |    3 ++-
 src/plugins/pgpcore/pgp_viewer.c                     |    1 +
 src/plugins/vcalendar/libical/libical/icalproperty.c |   13 +++++++------
 src/textview.c                                       |    1 +
 5 files changed, 18 insertions(+), 14 deletions(-)


- Log -----------------------------------------------------------------
commit 498b61cc586e6e258fb9299d14b49ec831ccb0f8
Author: wwp <wwp at free.fr>
Date:   Fri Jan 13 09:19:41 2017 +0100

    Prefer dynamically allocated buffers to fixed-size ones, use the same

diff --git a/src/compose.c b/src/compose.c
index 0c14790..bdb14b4 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -9478,7 +9478,7 @@ static gboolean compose_get_ext_editor_cmd_valid()
 
 static gint compose_exec_ext_editor_real(const gchar *file, GdkNativeWindow socket_wid)
 {
-	gchar buf[1024];
+	gchar *buf;
 	gchar *p, *s;
 	gchar **cmdline;
 	pid_t pid;
@@ -9503,22 +9503,22 @@ static gint compose_exec_ext_editor_real(const gchar *file, GdkNativeWindow sock
 			s = strstr(p, "%w");
 			s[1] = 'u';
 			if (strstr(p, "%s") < s)
-				g_snprintf(buf, sizeof(buf), p, file, socket_wid);
+				buf = g_strdup_printf(p, file, socket_wid);
 			else
-				g_snprintf(buf, sizeof(buf), p, socket_wid, file);
+				buf = g_strdup_printf(p, socket_wid, file);
 			g_free(p);
 		} else {
-			g_snprintf(buf, sizeof(buf),
-				   prefs_common_get_ext_editor_cmd(), file);
+			buf = g_strdup_printf(prefs_common_get_ext_editor_cmd(), file);
 		}
 	} else {
 		if (prefs_common_get_ext_editor_cmd())
 			g_warning("External editor command-line is invalid: '%s'",
 				  prefs_common_get_ext_editor_cmd());
-		g_snprintf(buf, sizeof(buf), DEFAULT_EDITOR_CMD, file);
+		buf = g_strdup_printf(DEFAULT_EDITOR_CMD, file);
 	}
 
-	cmdline = strsplit_with_quote(buf, " ", 1024);
+	cmdline = strsplit_with_quote(buf, " ", 0);
+	g_free(buf);
 	execvp(cmdline[0], cmdline);
 
 	perror("execvp");
diff --git a/src/crash.c b/src/crash.c
index a484012..8df5d9f 100644
--- a/src/crash.c
+++ b/src/crash.c
@@ -369,7 +369,7 @@ static void crash_debug(unsigned long crash_pid,
 			perror("dup");
 		close(choutput[0]);
 		if (-1 == execvp("gdb", argp)) 
-			g_print("error execvp\n");
+			perror("execvp");
 	} else {
 		char buf[100];
 		int r;
@@ -547,6 +547,7 @@ static void crash_handler(int sig)
 		if (setuid(getuid()) != 0 )
 			perror("setuid");
 		execvp(argv0, args);
+		perror("execvp");
 	} else {
 		waitpid(pid, NULL, 0);
 		crash_cleanup_exit();
diff --git a/src/plugins/pgpcore/pgp_viewer.c b/src/plugins/pgpcore/pgp_viewer.c
index d1b0448..0142760 100644
--- a/src/plugins/pgpcore/pgp_viewer.c
+++ b/src/plugins/pgpcore/pgp_viewer.c
@@ -208,6 +208,7 @@ static void pgpview_show_mime_part(TextView *textview, MimeInfo *partinfo)
 				gchar **argv;
 				argv = strsplit_with_quote(cmd, " ", 0);
 				res = execvp(argv[0], argv);
+				perror("execvp");
 				exit(255);
 			} else {
 				int status = 0;
diff --git a/src/plugins/vcalendar/libical/libical/icalproperty.c b/src/plugins/vcalendar/libical/libical/icalproperty.c
index 855e24b..6faaf8a 100644
--- a/src/plugins/vcalendar/libical/libical/icalproperty.c
+++ b/src/plugins/vcalendar/libical/libical/icalproperty.c
@@ -44,8 +44,8 @@
 #include <errno.h>
 #include <stdio.h> /* for printf */
 #include <stdarg.h> /* for va_list, va_start, etc. */
-                                               
-#define TMP_BUF_SIZE 1024
+
+#define BUF_SIZE 1024
 
 /* Private routines for icalproperty */
 void icalvalue_set_parent(icalvalue* value,
@@ -175,7 +175,7 @@ icalproperty_new_clone(icalproperty* prop)
 icalproperty* icalproperty_new_from_string(char* str)
 {
 
-    size_t buf_size = 1024;
+    size_t buf_size = BUF_SIZE;
     char* buf;
     char* buf_ptr;  
     icalproperty *prop;
@@ -279,7 +279,7 @@ icalproperty_as_ical_string (icalproperty* prop)
        the caller forgetting to free it */
 
     const char* property_name = 0; 
-    size_t buf_size = 1024;
+    size_t buf_size = BUF_SIZE;
     char* buf;
     char* buf_ptr;
     icalvalue* value;
@@ -381,9 +381,10 @@ icalproperty_as_ical_string (icalproperty* prop)
 	}
 
 	if (kind_string == 0 ) {
-	    char temp[TMP_BUF_SIZE];
-	    snprintf(temp, TMP_BUF_SIZE,"Got a parameter of unknown kind in %s property",property_name);
+	    char *temp;
+	    temp = g_strdup_printf(temp, "Got a parameter of unknown kind in %s property", property_name);
 	    icalerror_warn(temp);
+	    g_free(temp);
 	    continue;
 	}
 
diff --git a/src/textview.c b/src/textview.c
index b73071f..7372a1c 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1141,6 +1141,7 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
 			close(pfd[0]);
 			rc = dup(pfd[1]);
 			rc = execvp(argv[0], argv);
+			perror("execvp");
 			close(pfd[1]);
 			g_print(_("The command to view attachment "
 			        "as text failed:\n"

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list