Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jbenner-radham/libsafec-strnlen_s
A header only implementation of "strnlen_s" from C11 - Annex K forked from libsafec (Safe C Library).
https://github.com/jbenner-radham/libsafec-strnlen_s
annex-k bounds-checking c11 safety secure-coding strnlen-s
Last synced: about 2 months ago
JSON representation
A header only implementation of "strnlen_s" from C11 - Annex K forked from libsafec (Safe C Library).
- Host: GitHub
- URL: https://github.com/jbenner-radham/libsafec-strnlen_s
- Owner: jbenner-radham
- License: mit
- Created: 2015-02-23T21:47:59.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-05T21:46:27.000Z (almost 10 years ago)
- Last Synced: 2023-03-30T08:33:24.380Z (almost 2 years ago)
- Topics: annex-k, bounds-checking, c11, safety, secure-coding, strnlen-s
- Language: C
- Size: 137 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# libsafec - strnlen_s
### Synopsis
```c
#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`.