[gnome-terminal] screen: Fix crash with empty child process command line



commit 1c7ed77b003f14bb94527c8fe548c6c414c0da9e
Author: Egmont Koblinger <egmont gmail com>
Date:   Thu Jan 8 14:33:13 2015 +0100

    screen: Fix crash with empty child process command line
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742560

 src/terminal-screen.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index ad78388..9f63239 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -1904,7 +1904,9 @@ terminal_screen_has_foreground_process (TerminalScreen *screen,
   if (process_name)
     gs_transfer_out_value (process_name, &name);
 
-  for (i = 0; i < len - 1; i++)
+  if (len > 0 && data[len - 1] == '\0')
+    len--;
+  for (i = 0; i < len; i++)
     {
       if (data[i] == '\0')
         data[i] = ' ';


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]