Maybe check if the buffer size fits and error out otherwise - also document the maximum size up in the comments.