str: Avoid passing null pointer to memcpy() in ds_put_substring().