The buffer library handles simple character arrays. Buffers are used for
various purposes in the library, most notably memory BIOs.
BUF_MEM_new() allocates a new buffer of zero size.
BUF_MEM_free() frees up an already existing buffer. The data is zeroed
before freeing up in case the buffer contains sensitive data.
BUF_MEM_grow() changes the size of an already existing buffer to
len. Any data already in the buffer is preserved if it increases in
BUF_strdup(), BUF_strndup(), BUF_memdup(), BUF_strlcpy() and
BUF_strlcat() are equivalents of the standard C library functions. The
dup() functions use OPENSSL_malloc() underneath and so should be used
in preference to the standard library for memory leak checking or
replacing the malloc() function.
Memory allocated from these functions should be freed up using the
BUF_strndup makes the explicit guarantee that it will never read past
the first siz bytes of str.