From 1afad677e9fc16cd9e0eabf415735c5c3e11c19f Mon Sep 17 00:00:00 2001 From: steve Date: Mon, 17 Mar 2003 23:47:25 +0000 Subject: [PATCH] Make a safe copy of const string values. --- vvp/vpi_const.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/vvp/vpi_const.cc b/vvp/vpi_const.cc index 4f01e57c9..ce00ebee7 100644 --- a/vvp/vpi_const.cc +++ b/vvp/vpi_const.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA */ #ifdef HAVE_CVS_IDENT -#ident "$Id: vpi_const.cc,v 1.27 2003/03/15 05:44:50 steve Exp $" +#ident "$Id: vpi_const.cc,v 1.28 2003/03/17 23:47:25 steve Exp $" #endif # include "vpi_priv.h" @@ -72,9 +72,9 @@ static void string_value(vpiHandle ref, p_vpi_value vp) vp->format = vpiStringVal; case vpiStringVal: - /* This value is already safe and persistent in the - vpiHandle. No need to copy it. */ - vp->value.str = rfp->value; + rbuf = need_result_buf(size + 1, RBUF_VAL); + strcpy(rbuf, (char*)rfp->value); + vp->value.str = rbuf; break; case vpiDecStrVal: @@ -633,6 +633,9 @@ vpiHandle vpip_make_dec_const(int value) /* * $Log: vpi_const.cc,v $ + * Revision 1.28 2003/03/17 23:47:25 steve + * Make a safe copy of const string values. + * * Revision 1.27 2003/03/15 05:44:50 steve * Remove excess assignment. *