carta
bson_strncpy(3)

bson_strncpy3

Parameters

•

dst: The destination buffer.

•

src: The src buffer.

•

size: The number of bytes to copy into dst, which must be at least that size.

Overview

Copies up to size bytes from src into dst. dst must be at least size bytes in size. A trailing \0 is always set.

Does nothing if size is zero.

bson_strncpy matches the behavior of the C11 standard strncpy_s, rather than strncpy. This means that bson_strncpy always writes a null terminator to dst, even if dst is too short to fit the entire string from src. If there is additional space left in dst after copying src, bson_strncpy does not fill the remaining space with null characters.

History

  • Debian 13 (Trixie): the text shown here
  • Debian 12 (Bookworm)
  • Debian 11 (Bullseye)
  • Debian 10 (Buster)
  • Debian 9 (Stretch)

Author

MongoDB, Inc

From libbson-doc 1.30.4-1+deb13u3 in Debian 13 (Trixie). Parsed by carta from the page's man source.