summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Naumov <alexander_naumov@opensuse.org>2022-01-20 18:21:33 +0200
committerAlexander Naumov <alexander_naumov@opensuse.org>2022-01-20 18:21:33 +0200
commitd591a396c7e41d10191c1f5676032d9e261da2f7 (patch)
tree4d0fca25b174776ff023b91ce2f9de8034f79c66
parenta13ee11b25ceeaa5771ba1e6edfba6d83fb57027 (diff)
downloadscreen-d591a396c7e41d10191c1f5676032d9e261da2f7.tar.gz
bugfix: session names limit is 80 symbols
bug #61534 Screen allowed you to specify a long session name (without any errors), but didn't run if session name was too long. This fix sets limit for 80 symbols and doesn't allow to use session names longer then this limit. Screen should print error message in case of too long session name.
-rw-r--r--src/doc/screen.13
-rw-r--r--src/screen.c11
2 files changed, 13 insertions, 1 deletions
diff --git a/src/doc/screen.1 b/src/doc/screen.1
index 92061b6..f2844a4 100644
--- a/src/doc/screen.1
+++ b/src/doc/screen.1
@@ -369,7 +369,8 @@ See also there.
When creating a new session, this option can be used to specify a
meaningful name for the session. This name identifies the session for
\*Qscreen \-list\*U and \*Qscreen \-r\*U actions. It substitutes the
-default [\fItty.host\fP] suffix.
+default [\fItty.host\fP] suffix. This name should not be longer
+then 80 symbols.
.TP 5
.BI "\-t " name
sets the title (a.\|k.\|a.) for the default shell or specified program.
diff --git a/src/screen.c b/src/screen.c
index 1a22892..8bce303 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -778,6 +778,10 @@ int main(int ac, char** av)
if (--ac == 0)
exit_with_usage(myname, "Specify session-name with -S", NULL);
SockMatch = *++av;
+ debug1("SockMatch: '%s'\n", SockMatch);
+ debug1("SockMatch len: '%d'\n", (int)strlen(SockMatch));
+ if (strlen(SockMatch) > 80)
+ exit_with_usage(myname, "Session-name is too long (max length is 80 symbols)", NULL);
}
if (!*SockMatch)
exit_with_usage(myname, "Empty session-name?", NULL);
@@ -1203,6 +1207,13 @@ int main(int ac, char** av)
SetTtyname(false, &st);
if (!*av)
Panic(0, "Please specify a command.");
+ if (!strncmp("sessionname", *av, 11)) {
+ if (!*++av)
+ Panic(0, "Please specify a parameter.");
+ if (strlen(*av) > 80)
+ Panic(0, "Parameter of command 'sessionname' is too long.");
+ *--av;
+ }
SET_GUID();
SendCmdMessage(sty, SockMatch, av, queryflag >= 0);
exit(0);