CRYPTO_strndup

Duplicate at most s characters of str using the OpenSSL allocator.

Synopsis

Declared in <openssl/crypto.h>

char*
CRYPTO_strndup(
    char const* str,
    size_t s,
    char const* file,
    int line);

Return Value

Newly allocated NUL-terminated copy, or NULL on failure.

Parameters

NameDescription
strSource bytes (NUL-terminated or truncated at s).
sMaximum number of characters to copy (excluding the added NUL).
fileSource file name recorded with the allocation (usually FILE).
lineSource line recorded with the allocation (usually LINE).