about summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2004-04-21 08:31:45 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2004-04-21 08:31:45 +0000
commitf34d9be61b047beadb24748163c1bc59a7eff9d3 (patch)
tree12eee9a05e946906b7a7286f1101f96a28d011fe /Src/prompt.c
parentc1e47cb71f9f974eba00e780746e092296ceb958 (diff)
downloadzsh-f34d9be61b047beadb24748163c1bc59a7eff9d3.tar.gz
zsh-f34d9be61b047beadb24748163c1bc59a7eff9d3.tar.xz
zsh-f34d9be61b047beadb24748163c1bc59a7eff9d3.zip
19806: fix bug with %v prompt expansion and negative index beyond array start
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index 7f964aad5..5e80da172 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -579,7 +579,7 @@ putpromptchar(int doprint, int endchar)
 		    arg = 1;
 		else if (arg < 0)
 		    arg += arrlen(psvar) + 1;
-		if (arrlen(psvar) >= arg)
+		if (arg > 0 && arrlen(psvar) >= arg)
 		    stradd(psvar[arg - 1]);
 		break;
 	    case 'E':