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

Functions

EXPORT errno_t strset_s (char *restrict dest, rsize_t dmax, int value)
 Sets maximal dmax characters of dest to a character value, but not the final NULL character. More...
 

Function Documentation

◆ strset_s()

EXPORT errno_t strset_s ( char *restrict  dest,
rsize_t  dmax,
int  value 
)

Sets maximal dmax characters of dest to a character value, but not the final NULL character.

With SAFECLIB_STR_NULL_SLACK defined all elements following the terminating null character (if any) written in the array of dmax characters pointed to by dest are nulled.

Remarks
EXTENSION TO
  • ISO/IEC TR 24731, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
  • Implemented in the Windows secure API as _strset_s()
Parameters
[out]deststring that will be set.
[in]dmaxrestricted maximum length of dest
[in]valuecharacter value to write
Precondition
dest shall not be a null pointer, and shall be null-terminated.
dmax shall not be greater than RSIZE_MAX_STR.
dmax shall not equal zero.
value shall not be greater than 255
Return values
EOKwhen successful
ESNULLPwhen dest is NULL pointer
ESZEROLwhen dmax = 0
ESLEMAXwhen dmax > RSIZE_MAX_STR or value > 255
See also
strzero_s(), strnset_s(), strispassword_s()