Set buffer to a copy of some raw data.
The buffer to set
The data to copy into the buffer
The length of the data to copy into the buffer
0 on success, -1 on allocation failure