Skip to content

A header only implementation of "strnlen_s" from C11 - Annex K forked from libsafec (Safe C Library).

License

Notifications You must be signed in to change notification settings

jbenner-radham/libsafec-strnlen_s

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libsafec - strnlen_s

Synopsis

#include "strnlen_s.h"

size_t strnlen_s(const char *s, size_t maxsize);

Description

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

Specified In

ISO/IEC TR 24731-1 §6.7.4.3, Programming languages, environments and system software interfaces, Extensions to the C Library, Part I: Bounds-checking interfaces.

Input Parameters

  • s pointer to string
  • maxsize restricted maximum length.

Output Parameters

none

Runtime Constraints

none

Returns

If s is a null pointer, then the strnlen_s function returns zero.

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 maxsize characters of s then strnlen_s returns maxsize. At most the first maxsize characters of s shall be accessed by strnlen_s.

About

A header only implementation of "strnlen_s" from C11 - Annex K forked from libsafec (Safe C Library).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages