safec  3.0
Safe C Library - ISO TR24731 Bounds Checking Interface
strcpyfldout_s.c File Reference
#include "safe_str_lib.h"
+ Include dependency graph for strcpyfldout_s.c:

Functions

EXPORT errno_t strcpyfldout_s (char *dest, rsize_t dmax, const char *src, rsize_t slen)
 The strcpyfldout_s function copies slen characters from the character array pointed to by src into the string pointed to by dest. More...
 

Function Documentation

◆ strcpyfldout_s()

EXPORT errno_t strcpyfldout_s ( char *  dest,
rsize_t  dmax,
const char *  src,
rsize_t  slen 
)

The strcpyfldout_s function copies slen characters from the character array pointed to by src into the string pointed to by dest.

A null is included to properly termiante the dest string. The copy operation does not stop on the null character as function copies dmax characters.

Remarks
EXTENSION TO ISO/IEC TR 24731, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
Parameters
[out]destpointer to string that will be replaced by src.
[in]dmaxrestricted maximum length of dest
[in]srcpointer to the character array to be copied to dest and null terminated.
[in]slenthe maximum number of characters that will be copied from the src field into the dest string.
Precondition
Neither dest nor src shall be a null pointer.
dmax shall not equal zero.
dmax shall not be greater than RSIZE_MAX_STR.
slen shall not equal zero.
slen shall not exceed dmax
Copying shall not take place between objects that overlap.
Returns
If there is a runtime-constraint violation, then if dest is not a null pointer and dmax is greater than zero and not greater than RSIZE_MAX_STR, then strcpyfldout_s nulls dest
Return values
EOKwhen successful operation
ESNULLPwhen dest/src is NULL pointer
ESZEROLwhen dmax/slen = 0
ESLEMAXwhen dmax > RSIZE_MAX_STR
ESOVRLPwhen strings overlap
ESNOSPCwhen dmax < slen
See also
strcpyfld_s(), strcpyfldin_s()