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

Functions

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

Function Documentation

◆ strcpyfldin_s()

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

The strcpyfldin_s function copies at most slen characters from the null terminated string pointed to by src into the fixed character array pointed to by dest.

The copy operation stops on the null character if encountered and then continues to fill the field with nulls up to dmax characters.

Remarks
EXTENSION TO ISO/IEC TR 24731-1, 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 null terminated string that will be copied into the character array pointed to by dest
[in]slenmaximum length of src
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 strcpyfldin_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(), strcpyfldout_s(),