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

Functions

EXPORT rsize_t strnlen_s (const char *dest, rsize_t dmax)
 The strnlen_s function computes the length of the string pointed to by dest. More...
 

Function Documentation

◆ strnlen_s()

EXPORT rsize_t strnlen_s ( const char *  dest,
rsize_t  dmax 
)

The strnlen_s function computes the length of the string pointed to by dest.

Remarks
SPECIFIED IN ISO/IEC TR 24731-1, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces
Parameters
destpointer to string
dmaxmaximum length of string
Precondition
dest shall not be a null pointer.
dmax shall not equal zero.
dmax shall not be greater than RSIZE_MAX_STR.
Returns
The function returns the string length, excluding the terminating null character. If dest is NULL, then strnlen_s returns 0. Otherwise, the strnlen_s function returns the number of characters that precede the terminating null character. If there is no null character in the first dmax characters of dest then strnlen_s returns dmax. At most the first dmax characters of dest are accessed by strnlen_s.
See also
strnterminate_s()