From 828f12b74876e9cc51fc60ab59f397d697f7041c Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Wed, 11 Aug 2010 07:45:06 +0000 Subject: [PATCH] Do not allow duplicate session names to be created, reported by Dominik Honnef, patch from Thomas Adam. --- cmd-rename-session.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd-rename-session.c b/cmd-rename-session.c index 679c6109..0b674ce0 100644 --- a/cmd-rename-session.c +++ b/cmd-rename-session.c @@ -45,6 +45,11 @@ cmd_rename_session_exec(struct cmd *self, struct cmd_ctx *ctx) struct cmd_target_data *data = self->data; struct session *s; + if (data->arg != NULL && session_find(data->arg) != NULL) { + ctx->error(ctx, "duplicate session: %s", data->arg); + return (-1); + } + if ((s = cmd_find_session(ctx, data->target)) == NULL) return (-1);