about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2008-10-30 09:52:15 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2008-10-30 09:52:15 +0000
commitdb68b7270f108e553c03f5b577e59a42064c5087 (patch)
tree29937723cf9a102aa6b0ab5a050b9113a9beb59d
parent787c86f68d36fa487daeb7f14adfdbf6e6a01238 (diff)
downloadzsh-db68b7270f108e553c03f5b577e59a42064c5087.tar.gz
zsh-db68b7270f108e553c03f5b577e59a42064c5087.tar.xz
zsh-db68b7270f108e553c03f5b577e59a42064c5087.zip
users/13418: protect against have_strcodes lying
-rw-r--r--ChangeLog5
-rw-r--r--Src/Modules/termcap.c10
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 90e3565b2..0a107e86d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-10-30  Peter Stephenson  <pws@csr.com>
+
+	* users/13418: Src/Modules/termcap.c: protect against
+	HAVE_STRCODES lying.
+
 2008-10-30  Clint Adams  <clint@zsh.org>
 
 	* 25949: Src/Zle/zle_hist.c: remove dead code in getvisrchstr.
diff --git a/Src/Modules/termcap.c b/Src/Modules/termcap.c
index 776351cf6..5e4cfa07f 100644
--- a/Src/Modules/termcap.c
+++ b/Src/Modules/termcap.c
@@ -235,7 +235,7 @@ scantermcap(UNUSED(HashTable ht), ScanFunc func, int flags)
 #endif
 
 #ifndef HAVE_STRCODES
-    static char *strcodes[] = {
+    static char *zstrcodes[] = {
 	"ac", "bt", "bl", "cr", "ZA", "ZB", "ZC", "ZD", "cs", "rP", "ct",
 	"MC", "cl", "cb", "ce", "cd", "ch", "CC", "CW", "cm", "do", "ho",
 	"vi", "le", "CM", "ve", "nd", "ll", "up", "vs", "ZE", "dc", "dl",
@@ -302,7 +302,13 @@ scantermcap(UNUSED(HashTable ht), ScanFunc func, int flags)
     pm->node.flags = PM_READONLY | PM_SCALAR;
     pm->gsu.s = &nullsetscalar_gsu;
 
-    for (capcode = (char **)strcodes; *capcode; capcode++) {
+    for (capcode = (char **)
+#ifdef HAVE_STRCODES
+	     strcodes
+#else
+	     zstrcodes
+#endif
+	     ; *capcode; capcode++) {
 	if ((tcstr = (char *)tgetstr(*capcode,&u)) != NULL &&
 	    tcstr != (char *)-1) {
 	    pm->u.str = dupstring(tcstr);