1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-28 05:00:59 +01:00

23696: x=x; x[-10]=y did bad things

This commit is contained in:
Peter Stephenson 2007-07-25 09:26:51 +00:00
parent 9084df4dc3
commit 4fab17e62a
3 changed files with 27 additions and 1 deletions

View file

@ -2076,8 +2076,11 @@ setstrvalue(Value v, char *val)
}
if (v->start > zlen)
v->start = zlen;
if (v->end < 0)
if (v->end < 0) {
v->end += zlen + 1;
if (v->end < 0)
v->end = 0;
}
else if (v->end > zlen)
v->end = zlen;
x = (char *) zalloc(v->start + strlen(val) + zlen - v->end + 1);