|
safec 3.15
Safe C Library - ISO TR24731 Bounds Checking Interface
|
#include "safe_str_lib.h"Functions | |
| EXPORT size_t | strlcpy (char *restrict dest, const char *restrict src, size_t dsize) |
strlcpy copies up to dsize - 1 characters from the NUL-terminated string src to dest, NUL-terminating the result (unless dsize is 0). | |
| EXPORT size_t strlcpy | ( | char *restrict | dest, |
| const char *restrict | src, | ||
| size_t | dsize ) |
strlcpy copies up to dsize - 1 characters from the NUL-terminated string src to dest, NUL-terminating the result (unless dsize is 0).
Unlike strncpy, it never writes more than dsize bytes in total and always NUL-terminates a non-zero sized buffer. The caller must check whether truncation occurred by comparing the return value against dsize.
This is only compiled in when the platform libc does not already provide strlcpy (see configure's HAVE_STRLCPY / cmake's HAVE_STRLCPY probe).
| [out] | dest | pointer to the buffer that will receive src |
| [in] | src | pointer to the NUL-terminated string to copy |
| [in] | dsize | size of the dest buffer, in bytes |
strlen(src). If the return value is >= dsize, the output was truncated.