about summary refs log tree commit diff
path: root/Src/Modules/parameter.c
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 /Src/Modules/parameter.c
parent0713dfcd1a1513d17d63eddaa8954f839ea5fefe (diff)
downloadzsh-724b065397e31d99fedffa613101293f2f14bca5.tar.gz
zsh-724b065397e31d99fedffa613101293f2f14bca5.tar.xz
zsh-724b065397e31d99fedffa613101293f2f14bca5.zip
more careful with checking index of $history (10614)
Diffstat (limited to 'Src/Modules/parameter.c')
-rw-r--r--Src/Modules/parameter.c14
1 files changed, 13 insertions, 1 deletions
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("");