Skip to content
Snippets Groups Projects
Commit 9fc94c15 authored by Pierre-Emmanuel Patry's avatar Pierre-Emmanuel Patry Committed by Arthur Cohen
Browse files

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: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
parent 46899985
No related branches found
No related tags found
No related merge requests found
...@@ -41,7 +41,8 @@ FFIString::make_ffistring (const std::string &str) ...@@ -41,7 +41,8 @@ FFIString::make_ffistring (const std::string &str)
FFIString FFIString
FFIString::make_ffistring (const unsigned char *data, std::uint64_t len) 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}; return {inner, len};
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment