[xterm/f20] fix crash with -S option (#1197828)

Miroslav Lichvar mlichvar at fedoraproject.org
Tue Mar 3 14:12:53 UTC 2015


commit 2b62629c24c7087efedb11c2e27825871952cf79
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Tue Mar 3 15:06:42 2015 +0100

    fix crash with -S option (#1197828)

 xterm-Soption.patch | 36 ++++++++++++++++++++++++++++++++++++
 xterm.spec          |  2 ++
 2 files changed, 38 insertions(+)
---
diff --git a/xterm-Soption.patch b/xterm-Soption.patch
new file mode 100644
index 0000000..3dd5f1c
--- /dev/null
+++ b/xterm-Soption.patch
@@ -0,0 +1,36 @@
+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"));
diff --git a/xterm.spec b/xterm.spec
index 88ae71c..df714a0 100644
--- a/xterm.spec
+++ b/xterm.spec
@@ -15,6 +15,7 @@ Source1: ftp://invisible-island.net/xterm/16colors.txt
 Patch1: xterm-resources.patch
 Patch2: xterm-desktop.patch
 Patch3: xterm-man-paths.patch
+Patch4: xterm-Soption.patch
 
 %bcond_with trace
 
@@ -31,6 +32,7 @@ programs that can't use the window system directly.
 %patch1 -p1 -b .resources
 %patch2 -p1 -b .desk
 %patch3 -p1 -b .man-paths
+%patch4 -p1 -b .Soption
 
 for f in THANKS; do
 	iconv -f iso8859-1 -t utf8 -o ${f}{_,} &&


More information about the scm-commits mailing list