summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-10 08:22:09 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-04-10 08:22:09 +0000
commit724b065397e31d99fedffa613101293f2f14bca5 (patch)
tree6736e5d4f3234cb8e75b89fcf46a55d66ab0923c
parent0713dfcd1a1513d17d63eddaa8954f839ea5fefe (diff)
downloadzsh-724b065397e31d99fedffa613101293f2f14bca5.tar.gz
zsh-724b065397e31d99fedffa613101293f2f14bca5.tar.xz
zsh-724b065397e31d99fedffa613101293f2f14bca5.zip
more careful with checking index of $history (10614)
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/parameter.c14
2 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 14b14af5a..9a4a845e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2000-04-10  Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
 
+	* 10614: Src/Modules/parameter.c: more careful with checking index
+ 	of $history
+	
 	* 10609: Src/Zle/compcore.c, Src/Zle/compresult.c, Src/Zle/zle_tricky.c:
  	fix for bashautolist+automenu
 	
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index e8e387a59..6bfe43479 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -1020,6 +1020,8 @@ getpmhistory(HashTable ht, char *name)
 {
     Param pm = NULL;
     Histent he;
+    char *p;
+    int ok = 1;
 
     pm = (Param) zhalloc(sizeof(struct param));
     pm->nam = dupstring(name);
@@ -1032,7 +1034,17 @@ getpmhistory(HashTable ht, char *name)
     pm->ename = NULL;
     pm->old = NULL;
     pm->level = 0;
-    if ((he = quietgethist(atoi(name))))
+
+    if (*name != '0' || name[1]) {
+	if (*name == '0')
+	    ok = 0;
+	else {
+	    for (p = name; *p && idigit(*p); p++);
+	    if (*p)
+		ok = 0;
+	}
+    }
+    if (ok && (he = quietgethist(atoi(name))))
 	pm->u.str = dupstring(he->text);
     else {
 	pm->u.str = dupstring("");