Currently, the `_new_from_buffer` function in `mc-tokens.c` calls `_mongocrypt_buffer_set_to` which shallow copies the data pointer. This presents an issue if the src buffer gets deleted later in the program (data pointer on dst buffer will be stale).
Creating a new function that instead calls `_mongocrypt_buffer_copy_to` instead will deep copy the src buffer, preventing this issue.
This behavior was exposed while refactoring FLETokens in the server to wrap around the token implementation in libmongocrypt.
- is related to
-
SERVER-96316 Refactor FLEToken types to wrap libmongocrypt
- In Progress