Use FFI::MemoryPointer from_string

Previously this code was using the string's size in characters NOT its size in bytes to determine how many bytes to copy into buf.  By using the FFI::MemoryPointer.from_string method this takes care of string encoding so that all of the string's bytes are copied.