Skip to content

[th/memdup] add nm_memcpy(), nm_memdup_nul() and use in nm_str_buf_finalize()

Thomas Haller requested to merge th/memdup into main
  • add nm_memcpy() to avoid pitfalls with NULL/dangling src buffer.
  • add nm_memdup_nul() helper as a replacement for g_strndup() -- which is not suitable for binary data or "strings" that contain NUL bytes.
  • use both in nm_str_buf_finalize(). NMStrBuf tracks the length separately, so it can also support embedded NUL characters in their strings. See 52041162.

Merge request reports