Discussion:
[PATCH] Don't segfault on NULL tty.path
(too old to reply)
Thomas Adam
2015-04-28 15:58:51 UTC
Permalink
When checking a client's tty path, don't segfault if it's NULL.
---
cmd-find.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/cmd-find.c b/cmd-find.c
index fab3849..3ac9936 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -243,6 +243,8 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)

/* If this is running in a pane, that's great. */
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
+ if (fs->cmdq->client->tty.path == NULL)
+ continue;
if (strcmp(wp->tty, fs->cmdq->client->tty.path) == 0)
break;
}
--
2.1.4
Nicholas Marriott
2015-04-28 16:18:32 UTC
Permalink
I don't think we should enter this function at all in that case, or perhaps just not do the loop

-------- Original message --------
From: Thomas Adam <***@xteddy.org>
Date:28/04/2015 16:58 (GMT+00:00)
To: tmux-***@lists.sourceforge.net
Cc: Thomas Adam <***@xteddy.org>
Subject: [PATCH] Don't segfault on NULL tty.path

When checking a client's tty path, don't segfault if it's NULL.
---
cmd-find.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/cmd-find.c b/cmd-find.c
index fab3849..3ac9936 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -243,6 +243,8 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)

/* If this is running in a pane, that's great. */
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
+ if (fs->cmdq->client->tty.path == NULL)
+ continue;
if (strcmp(wp->tty, fs->cmdq->client->tty.path) == 0)
break;
}
--
2.1.4
Nicholas Marriott
2015-04-28 23:06:42 UTC
Permalink
Actually I think I already fixed this?
Post by Thomas Adam
When checking a client's tty path, don't segfault if it's NULL.
---
cmd-find.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/cmd-find.c b/cmd-find.c
index fab3849..3ac9936 100644
--- a/cmd-find.c
+++ b/cmd-find.c
@@ -243,6 +243,8 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs)
/* If this is running in a pane, that's great. */
RB_FOREACH(wp, window_pane_tree, &all_window_panes) {
+ if (fs->cmdq->client->tty.path == NULL)
+ continue;
if (strcmp(wp->tty, fs->cmdq->client->tty.path) == 0)
break;
}
--
2.1.4
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
tmux-users mailing list
https://lists.sourceforge.net/lists/listinfo/tmux-users
Thomas Adam
2015-04-29 22:38:57 UTC
Permalink
Post by Nicholas Marriott
Actually I think I already fixed this?
Yes, I think you rolled this into a larger fix for something else. It
doesn't crash for me anymore.

Cheers,

-- Thomas Adam
--
"Deep in my heart I wish I was wrong. But deep in my heart I know I am
not." -- Morrissey ("Girl Least Likely To" -- off of Viva Hate.)
Loading...