diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-09-06 15:28:17 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-09-06 15:28:17 +0000 |
commit | f2d873d8114561c4c8658659408d9cecfe60a0fc (patch) | |
tree | 31360e794f27687dd30dc2e6e1a0dda8e8aaafd6 /Src/params.c | |
parent | 394ab0aeb72190e66aca3b3d21c9d3264fe1129f (diff) | |
download | zsh-f2d873d8114561c4c8658659408d9cecfe60a0fc.tar.gz zsh-f2d873d8114561c4c8658659408d9cecfe60a0fc.tar.xz zsh-f2d873d8114561c4c8658659408d9cecfe60a0fc.zip |
21701: Negative subscripts of scalars before start were broken
Diffstat (limited to 'Src/params.c')
-rw-r--r-- | Src/params.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Src/params.c b/Src/params.c index 26b3f3133..1cff358df 100644 --- a/Src/params.c +++ b/Src/params.c @@ -1565,8 +1565,11 @@ getstrvalue(Value v) if (v->start == 0 && v->end == -1) return s; - if (v->start < 0) + if (v->start < 0) { v->start += strlen(s); + if (v->start < 0) + v->start = 0; + } if (v->end < 0) v->end += strlen(s) + 1; s = (v->start > (int)strlen(s)) ? dupstring("") : dupstring(s + v->start); |