Fix various problems with embedded nulls and truncated messages

* Don't use strndup to copy a ruby string, use memcpy
* Use RSTRING_LEN, not strlen() to find out string length
* Use RSTRING_PTR instead of StringValuePtr, because we've already
  asserted the VALUE is a string with Check_Type

cc @patrickt