From cdfea6589412d7ba61abeb0e9b29a4e36fa41e28 Mon Sep 17 00:00:00 2001 From: kre Date: Wed, 12 Jul 2017 19:06:16 +0000 Subject: [PATCH] Fix a reference after free (and consequent nonsense diagnostic for attempts to set readonly variables) I added in 1.60 by incompletely copying the FreeBSD fix for the lost memory issue. --- bin/sh/var.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/sh/var.c b/bin/sh/var.c index 70770e7d2da5..85ad50dafc87 100644 --- a/bin/sh/var.c +++ b/bin/sh/var.c @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.64 2017/07/05 20:00:27 kre Exp $ */ +/* $NetBSD: var.c,v 1.65 2017/07/12 19:06:16 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95"; #else -__RCSID("$NetBSD: var.c,v 1.64 2017/07/05 20:00:27 kre Exp $"); +__RCSID("$NetBSD: var.c,v 1.65 2017/07/12 19:06:16 kre Exp $"); #endif #endif /* not lint */ @@ -431,7 +431,7 @@ setvareq(char *s, int flags) ckfree(s); if (flags & VNOERROR) return; - 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)