> I guess I could add a NUL character to the end of the input strings, which > would allow me to cast to cstring on retrieval.
If you can add the '0' character with which C strings are generally terminated, then you do not need alloc() and copyMem(). Bytes sequences terminated with '0' looks like regular C strings, so you should be able to cast to a C string and assign to a regular Nim string like "var str: string = $cast[cstring](myByteData)". The $ converts from cstring to nim string.
