Sat Dec 24 13:18:43 2016 UTC ()
Apply fixes from upstream to prevent a crash and a usability issue:
- Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)
- Fix out of bounds read (Brooks Davis)
- Don't play pointer tricks that are undefined in modern c (Brooks Davis)
- Use `` instead $() for solaris, bleh.


(kim)
diff -r1.82 -r1.83 pkgsrc/shells/tcsh/Makefile
diff -r1.37 -r1.38 pkgsrc/shells/tcsh/distinfo
diff -r0 -r1.1 pkgsrc/shells/tcsh/patches/patch-ed.chared.c
diff -r0 -r1.1 pkgsrc/shells/tcsh/patches/patch-nls-catgen
diff -r0 -r1.1 pkgsrc/shells/tcsh/patches/patch-sh.func.c
diff -r0 -r1.1 pkgsrc/shells/tcsh/patches/patch-tw.init.c

cvs diff -r1.82 -r1.83 pkgsrc/shells/tcsh/Makefile (expand / switch to unified diff)

--- pkgsrc/shells/tcsh/Makefile 2016/11/24 15:45:06 1.82
+++ pkgsrc/shells/tcsh/Makefile 2016/12/24 13:18:43 1.83
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1# $NetBSD: Makefile,v 1.82 2016/11/24 15:45:06 christos Exp $ 1# $NetBSD: Makefile,v 1.83 2016/12/24 13:18:43 kim Exp $
2 2
3DISTNAME= tcsh-6.20.00 3DISTNAME= tcsh-6.20.00
4#PKGREVISION= 1 4PKGREVISION= 1
5CATEGORIES= shells 5CATEGORIES= shells
6MASTER_SITES= ftp://ftp.astron.com/pub/tcsh/ \ 6MASTER_SITES= ftp://ftp.astron.com/pub/tcsh/ \
7 ftp://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/ 7 ftp://ftp.funet.fi/pub/mirrors/ftp.astron.com/pub/tcsh/
8 8
9MAINTAINER= kimmo@suominen.com 9MAINTAINER= kimmo@suominen.com
10HOMEPAGE= http://www.tcsh.org/ 10HOMEPAGE= http://www.tcsh.org/
11COMMENT= Extended C-shell with many useful features 11COMMENT= Extended C-shell with many useful features
12LICENSE= original-bsd 12LICENSE= original-bsd
13 13
14CONFLICTS?= static-tcsh-[0-9]* 14CONFLICTS?= static-tcsh-[0-9]*
15 15
16GNU_CONFIGURE= yes 16GNU_CONFIGURE= yes
17 17

cvs diff -r1.37 -r1.38 pkgsrc/shells/tcsh/distinfo (expand / switch to unified diff)

--- pkgsrc/shells/tcsh/distinfo 2016/11/24 15:45:06 1.37
+++ pkgsrc/shells/tcsh/distinfo 2016/12/24 13:18:43 1.38
@@ -1,10 +1,14 @@ @@ -1,10 +1,14 @@
1$NetBSD: distinfo,v 1.37 2016/11/24 15:45:06 christos Exp $ 1$NetBSD: distinfo,v 1.38 2016/12/24 13:18:43 kim Exp $
2 2
3SHA1 (tcsh-6.20.00.tar.gz) = a77d68434cc4bed731a46a39b9e01523e3a1e98c 3SHA1 (tcsh-6.20.00.tar.gz) = a77d68434cc4bed731a46a39b9e01523e3a1e98c
4RMD160 (tcsh-6.20.00.tar.gz) = 3f119421ef3500cea1bebe2edf35c6d81ca1c8f3 4RMD160 (tcsh-6.20.00.tar.gz) = 3f119421ef3500cea1bebe2edf35c6d81ca1c8f3
5SHA512 (tcsh-6.20.00.tar.gz) = c5635393c22341e62fb9a0b953ddf8871a876ab09deb08c98237f93afa9257b4a3381d1db65eefe769e22ef845db29ab7bc78773f1f609d73c8205689a6683e9 5SHA512 (tcsh-6.20.00.tar.gz) = c5635393c22341e62fb9a0b953ddf8871a876ab09deb08c98237f93afa9257b4a3381d1db65eefe769e22ef845db29ab7bc78773f1f609d73c8205689a6683e9
6Size (tcsh-6.20.00.tar.gz) = 1001696 bytes 6Size (tcsh-6.20.00.tar.gz) = 1001696 bytes
7SHA1 (patch-aa) = 440849534fc49afdbd70b95d6cbc62ff5abee240 7SHA1 (patch-aa) = 440849534fc49afdbd70b95d6cbc62ff5abee240
8SHA1 (patch-ab) = 8cf26988778b5331360eb1aab98bfcc920c71ac2 8SHA1 (patch-ab) = 8cf26988778b5331360eb1aab98bfcc920c71ac2
9SHA1 (patch-configure) = 91c2019da8c074bd6f24b84bf798ccd497110727 9SHA1 (patch-configure) = 91c2019da8c074bd6f24b84bf798ccd497110727
 10SHA1 (patch-ed.chared.c) = d26ba00afcba958b5bb1efc2171e6211c8a5f964
 11SHA1 (patch-nls-catgen) = fe5da1ea0edfcb646bcc271e614f5075afa56c60
 12SHA1 (patch-sh.func.c) = 030a2647930300f96147715ae17ab95c79ca8ca2
10SHA1 (patch-sh.h) = ac6211ddd5e552e9baec2d35aed5e7e573cab04e 13SHA1 (patch-sh.h) = ac6211ddd5e552e9baec2d35aed5e7e573cab04e
 14SHA1 (patch-tw.init.c) = 4ed0f6632e149d8badcb8338817af5f9095e34b4

File Added: pkgsrc/shells/tcsh/patches/Attic/patch-ed.chared.c
$NetBSD: patch-ed.chared.c,v 1.1 2016/12/24 13:18:43 kim Exp $

Fix out of bounds read (Brooks Davis)
(reproduce by starting tcsh and hitting tab at the prompt)

Index: ed.chared.c
===================================================================
RCS file: /p/tcsh/cvsroot/tcsh/ed.chared.c,v
retrieving revision 3.103
retrieving revision 3.104
diff -u -r3.103 -r3.104
--- ed.chared.c	19 Aug 2015 14:29:55 -0000	3.103
+++ ed.chared.c	2 Dec 2016 16:59:28 -0000	3.104
@@ -750,7 +750,7 @@
     /*
      * If we found a history character, go expand it.
      */
-    if (HIST != '\0' && *p == HIST)
+    if (p >= InputBuf && HIST != '\0' && *p == HIST)
 	nr_exp = c_excl(p);
     else
         nr_exp = 0;

File Added: pkgsrc/shells/tcsh/patches/Attic/patch-nls-catgen
$NetBSD: patch-nls-catgen,v 1.1 2016/12/24 13:18:43 kim Exp $

use `` instead $() for solaris, bleh.

Index: nls/catgen
===================================================================
RCS file: /p/tcsh/cvsroot/tcsh/nls/catgen,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- nls/catgen	25 Jul 2014 14:45:25 -0000	1.4
+++ nls/catgen	26 Nov 2016 00:35:37 -0000	1.5
@@ -13,8 +13,8 @@
 shift
 CHARSET="$1"
 shift
-cat "${CHARSET}" $(sortit "$@") > "$TMP"
+cat "${CHARSET}" `sortit "$@"` > "$TMP"
 
-echo "$(basename "$OUT" .cat)"
+echo "`basename "$OUT" .cat`"
 "${GENCAT}" "$OUT" "$TMP"
 exit 0

File Added: pkgsrc/shells/tcsh/patches/Attic/patch-sh.func.c
$NetBSD: patch-sh.func.c,v 1.1 2016/12/24 13:18:43 kim Exp $

Fix type of read in prompt confirmation (eg. rmstar) (David Kaspar)

Index: sh.func.c
===================================================================
RCS file: /p/tcsh/cvsroot/tcsh/sh.func.c,v
retrieving revision 3.176
retrieving revision 3.177
diff -u -r3.176 -r3.177
--- sh.func.c	18 Oct 2016 17:26:42 -0000	3.176
+++ sh.func.c	28 Nov 2016 17:14:20 -0000	3.177
@@ -2734,16 +2734,18 @@
 int
 getYN(const char *prompt)
 {
-    int doit, c;
+    int doit;
+    char c;
+
     xprintf("%s", prompt);
     flush();
-    (void) force_read(SHIN, &c, 1);
+    (void) force_read(SHIN, &c, sizeof(c));
     /* 
      * Perhaps we should use the yesexpr from the
      * actual locale
      */
     doit = (strchr(CGETS(22, 14, "Yy"), c) != NULL);
-    while (c != '\n' && force_read(SHIN, &c, 1) == 1)
+    while (c != '\n' && force_read(SHIN, &c, sizeof(c)) == sizeof(c))
 	continue;
     return doit;
 }

File Added: pkgsrc/shells/tcsh/patches/Attic/patch-tw.init.c
$NetBSD: patch-tw.init.c,v 1.1 2016/12/24 13:18:43 kim Exp $

Don't play pointer tricks that are undefined in modern c (Brooks Davis)

Index: tw.init.c
===================================================================
RCS file: /p/tcsh/cvsroot/tcsh/tw.init.c,v
retrieving revision 3.42
retrieving revision 3.43
diff -u -r3.42 -r3.43
--- tw.init.c	17 Apr 2011 14:49:30 -0000	3.42
+++ tw.init.c	7 Dec 2016 02:52:27 -0000	3.43
@@ -125,9 +125,8 @@
 	sl->buff = xrealloc(sl->buff, sl->tbuff * sizeof(Char));
 	/* Re-thread the new pointer list, if changed */
 	if (ptr != NULL && ptr != sl->buff) {
-	    intptr_t offs = sl->buff - ptr;
 	    for (i = 0; i < sl->nlist; i++)
-		sl->list[i] += offs;
+		sl->list[i] = sl->buff + (sl->list[i] - ptr);
 	}
 	disabled_cleanup(&pintr_disabled);
     }