sh: Fix use-after-free when attempting to modify a read-only variable.

Reported by:	bapt
MFC after:	1 week
This commit is contained in:
jilles 2015-12-16 20:33:47 +00:00
parent 22b67b80a9
commit 75b5654b2a

View File

@ -330,7 +330,7 @@ setvareq(char *s, int flags)
if (vp->flags & VREADONLY) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)
ckfree(s);
error("%.*s: is read only", vp->name_len, s);
error("%.*s: is read only", vp->name_len, vp->text);
}
if (flags & VNOSET) {
if ((flags & (VTEXTFIXED|VSTACK)) == 0)