gccrs: libproc_macro: Copy ffistring data from source

Data from source pointer were not copied correctly in the ffistring
constructor.

libgrust/ChangeLog:

	* libproc_macro/ffistring.cc (FFIString::make_ffistring):
	Add copy from source pointer.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
This commit is contained in:
Pierre-Emmanuel Patry 2023-05-16 13:25:40 +02:00 committed by Arthur Cohen
parent 4689998556
commit 9fc94c1562

View File

@ -41,7 +41,8 @@ FFIString::make_ffistring (const std::string &str)
FFIString
FFIString::make_ffistring (const unsigned char *data, std::uint64_t len)
{
const unsigned char *inner = new unsigned char[len];
unsigned char *inner = new unsigned char[len];
std::memcpy (inner, data, len);
return {inner, len};
}