The branch, hooks has been updated via 363c32c4f840ff83c51a87ef7cf26645f7e58b21 (commit) from 5e5b1c8843541e6e2f6d3b21c0869dec1acde287 (commit)
- Log ----------------------------------------------------------------- commit 363c32c4f840ff83c51a87ef7cf26645f7e58b21 Author: Thomas Adam <tho...@xteddy.org> Commit: Thomas Adam <tho...@xteddy.org> Fix attach without -t crash The check (in this case) for attach without -t resulted in a segfault, because tflag was still NULL at the point of looking up the PANE_ID before the session. Instead, check for tflag not being NULL before that point, and if it's stll NULL when looking up the session, don't segfault looking up the other bits of information for the window, winlink, etc. Since this could technically apply to sflag as well, also do likewise. --- cmd.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd.c b/cmd.c index 14850dc..3ff7298 100644 --- a/cmd.c +++ b/cmd.c @@ -389,7 +389,7 @@ cmd_set_state_tflag(struct cmd *cmd, struct cmd_q *cmdq) case 0: break; case CMD_PREP_SESSION_T|CMD_PREP_PANE_T: - if (tflag[strcspn(tflag, ":.")] != '\0') { + if (tflag != NULL && tflag[strcspn(tflag, ":.")] != '\0') { state->tflag.wl = cmd_find_pane(cmdq, tflag, &state->tflag.s, &state->tflag.wp); if (state->tflag.wl == NULL) @@ -509,7 +509,7 @@ cmd_set_state_sflag(struct cmd *cmd, struct cmd_q *cmdq) case 0: break; case CMD_PREP_SESSION_S|CMD_PREP_PANE_S: - if (sflag[strcspn(sflag, ":.")] != '\0') { + if (sflag != NULL && sflag[strcspn(sflag, ":.")] != '\0') { state->sflag.wl = cmd_find_pane(cmdq, sflag, &state->sflag.s, &state->sflag.wp); if (state->sflag.wl == NULL) @@ -1056,7 +1056,7 @@ cmd_lookup_paneid(const char *arg) const char *errstr; u_int paneid; - if (*arg != '%') + if (arg == NULL || *arg != '%') return (NULL); paneid = strtonum(arg + 1, 0, UINT_MAX, &errstr); @@ -1072,7 +1072,7 @@ cmd_lookup_winlink_windowid(struct session *s, const char *arg) const char *errstr; u_int windowid; - if (*arg != '@') + if (arg == NULL || *arg != '@') return (NULL); windowid = strtonum(arg + 1, 0, UINT_MAX, &errstr); @@ -1088,7 +1088,7 @@ cmd_lookup_windowid(const char *arg) const char *errstr; u_int windowid; - if (*arg != '@') + if (arg == NULL || *arg != '@') return (NULL); windowid = strtonum(arg + 1, 0, UINT_MAX, &errstr); ----------------------------------------------------------------------- Summary of changes: cmd.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) hooks/post-receive -- tmux ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ tmux-cvs mailing list tmux-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tmux-cvs