[Xfce4-commits] [apps/xfce4-taskmanager] 01/01: Make sure only printable characters are used in the pretty cmdline display (bug 14172)

noreply at xfce.org noreply at xfce.org
Sun May 27 12:01:07 CEST 2018


This is an automated email from the git hooks/post-receive script.

l   a   n   d   r   y       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/xfce4-taskmanager.

commit fd9e313e2e89ed0b81bec8c491842e7032e797ac
Author: Rozhuk Ivan <rozhuk.im at gmail.com>
Date:   Sun May 27 12:00:01 2018 +0200

    Make sure only printable characters are used in the pretty cmdline display (bug 14172)
---
 src/task-manager.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/task-manager.c b/src/task-manager.c
index db7a692..cb34ddd 100644
--- a/src/task-manager.c
+++ b/src/task-manager.c
@@ -137,16 +137,21 @@ setting_changed (GObject *object, GParamSpec *pspec, XtmTaskManager *manager)
 static gchar *
 pretty_cmdline (gchar *cmdline, gchar *comm)
 {
-	gchar *text = g_strchomp (g_strdelimit (g_strdup (cmdline), "\n\r", ' '));
-	if (!full_cmdline && g_utf8_strlen (text, -1) > 3)
+	/* Use the printable range of 0x20-0x7E */
+	const gchar *valid_chars = " !\"#$%&'()*+,-./0123456789:;<=>?@"
+				   "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
+				   "abcdefghijklmnopqrstuvwxyz{|}~";
+	gchar *text = g_strstrip (g_strcanon (g_strdup (cmdline), valid_chars, ' '));
+	gsize text_size = (gsize)strlen (text);
+	if (!full_cmdline && text_size > 3)
 	{
 		/* Shorten full path to commands and wine applications */
 		if (text[0] == '/' || (g_ascii_isupper (text[0]) && text[1] == ':' && text[2] == '\\'))
 		{
-			gchar *p = g_strstr_len (text, -1, comm);
+			gchar *p = g_strstr_len (text, (gssize)text_size, comm);
 			if (p != NULL)
 			{
-				g_strlcpy (text, p, g_utf8_strlen (text, -1));
+				g_strlcpy (text, p, text_size);
 			}
 		}
 	}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list