diff -up xterm-308/main.c.Soption xterm-308/main.c
--- xterm-308/main.c.Soption 2015-03-03 14:56:32.694437394 +0100
+++ xterm-308/main.c 2015-03-03 14:58:50.729807609 +0100
@@ -777,7 +777,8 @@ static char etc_wtmp[] = WTMP_FILENAME;
static char bin_login[] = LOGIN_FILENAME;
#endif
-static char passedPty[PTYCHARLEN + 1]; /* name if pty if slave */
+static char noPassedPty[2];
+static char *passedPty = noPassedPty; /* name if pty if slave */
#if defined(TIOCCONS) || defined(SRIOCSREDIR)
static int Console;
@@ -1758,6 +1759,7 @@ ParseSccn(char *option)
char *leaf = x_basename(option);
Bool code = False;
+ passedPty = x_strdup(option);
if (leaf != option) {
if (leaf - option > 0
&& isdigit(CharOf(*leaf))
@@ -1769,13 +1771,13 @@ ParseSccn(char *option)
* the /dev/pts/XXX value, but since we do not need to reopen it,
* it is useful mainly for display in a "ps -ef".
*/
- strncpy(passedPty, option, len);
passedPty[len] = 0;
code = True;
}
} else {
code = (sscanf(option, "%c%c%d",
passedPty, passedPty + 1, &am_slave) == 3);
+ passedPty[2] = '\0';
}
TRACE(("ParseSccn(%s) = '%s' %d (%s)\n", option,
passedPty, am_slave, code ? "OK" : "ERR"));