this seems like the best way to do it.
Use direct mem copying into the buf instead of writing to it with the writer interface. Probably better to use the writer actually, since this suffers from the same issue with the extra two null bytes.
Make it so I can specify the payload message