If you have a process running in a window and create a new window with
it focused, a NULL dereference can occur if the process is not owned by
the user (e.g., a root shell). Patch attached.
--Ben
>From c9d364132951dcba3a46af008d00edbb0ac6355d Mon Sep 17 00:00:00 2001
From: Ben Boeckel <maths...@gmail.com>
Date: Sun, 5 Feb 2012 23:38:24 -0500
Subject: [PATCH] Handle the case where root is NULL
If osdep_get_cwd returns NULL, the root[skip] causes a NULL dereference.
In this case, avoid jumping to the complete_path label. Falling through
and returning s->cwd should be "good enough".
This occurs when the pid of the window is not accessible by the user
(e.g., a root shell).
---
trunk/cmd.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/trunk/cmd.c b/trunk/cmd.c
index a58b0d5..7ba29e0 100644
--- a/trunk/cmd.c
+++ b/trunk/cmd.c
@@ -1308,7 +1308,8 @@ cmd_get_default_path(struct cmd_ctx *ctx, const char *cwd)
else
return (s->cwd);
skip = 0;
- goto complete_path;
+ if (root == NULL)
+ goto complete_path;
}
return (s->cwd);
--
1.7.6.5
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users