diff --git a/doc/safec-3.4/annotated.html b/doc/safec-3.4/annotated.html new file mode 100644 index 0000000000000000000000000000000000000000..2515ffe5bbcac121fc1ec663cebb91e5ac2f190d --- /dev/null +++ b/doc/safec-3.4/annotated.html @@ -0,0 +1,107 @@ + + +
+ + + + +|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
| CUNWIF_cc | |
| CUNWIF_compat_exc_t | |
| CUNWIF_complist | |
| CUNWIF_complist_s |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Variables | |
| static const char * | errmsgs_s [] |
| static const int | len_errmsgs_s [] |
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsset_s.c:+Functions | |
| EXPORT errno_t | _wcsset_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t value, const size_t destbos) |
| EXPORT errno_t _wcsset_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t | +value, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memzero_s.c:+Functions | |
| EXPORT errno_t | _memzero_s_chk (void *dest, rsize_t len, const size_t destbos) |
| EXPORT errno_t _memzero_s_chk | +( | +void * | +dest, | +
| + | + | rsize_t | +len, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memmove32_s.c:+Functions | |
| EXPORT errno_t | _memmove32_s_chk (uint32_t *dest, rsize_t dmax, const uint32_t *src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vswscanf_s.c:+Functions | |
| EXPORT int | vswscanf_s (const wchar_t *restrict src, const wchar_t *restrict fmt, va_list ap) |
| The vswscanf_s function reads a formatted wide string. More... | |
| EXPORT int vswscanf_s | +( | +const wchar_t *restrict | +src, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vswscanf_s function reads a formatted wide string.
+Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf.
| [in] | src | pointer to a null-terminated wide string to read from |
| [in] | fmt | format-control wide string. |
| [in] | ap | arguments to write to |
src nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for scanf_s.c:+Functions | |
| EXPORT int | scanf_s (const char *restrict fmt,...) |
The scanf_s function reads a formatted string from stdin, and writes to a list of arguments. More... | |
| EXPORT int scanf_s | +( | +const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The scanf_s function reads a formatted string from stdin, and writes to a list of arguments.
Reaching the end of the io buffer is equivalent to reaching the end-of-file condition for fscanf.
| [in] | fmt | format-control string. |
| [out] | ... | arguments to write to |
fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include <errno.h>
Include dependency graph for safe_lib_errno.h:
This graph shows which files directly or indirectly include this file:+Macros | |
| #define | ESNULLP ( 400 ) /* null ptr */ |
| #define | ESZEROL ( 401 ) /* length is zero */ |
| #define | ESLEMIN ( 402 ) /* length is below min */ |
| #define | ESLEMAX ( 403 ) /* length exceeds RSIZE_MAX */ |
| #define | ESOVRLP ( 404 ) /* overlap undefined */ |
| #define | ESEMPTY ( 405 ) /* empty string */ |
| #define | ESNOSPC ( 406 ) /* not enough space for s2 */ |
| #define | ESUNTERM ( 407 ) /* unterminated string */ |
| #define | ESNODIFF ( 408 ) /* no difference */ |
| #define | ESNOTFND ( 409 ) /* not found */ |
| #define | ESLEWRNG ( 410 ) /* wrong size */ |
| #define | ESLAST ESLEWRNG |
| #define | EOK ( 0 ) |
| #define ESNULLP ( 400 ) /* null ptr */ | +
| #define ESZEROL ( 401 ) /* length is zero */ | +
| #define ESLEMIN ( 402 ) /* length is below min */ | +
| #define ESLEMAX ( 403 ) /* length exceeds RSIZE_MAX */ | +
| #define ESOVRLP ( 404 ) /* overlap undefined */ | +
| #define ESEMPTY ( 405 ) /* empty string */ | +
| #define ESNOSPC ( 406 ) /* not enough space for s2 */ | +
| #define ESUNTERM ( 407 ) /* unterminated string */ | +
| #define ESNODIFF ( 408 ) /* no difference */ | +
| #define ESNOTFND ( 409 ) /* not found */ | +
| #define ESLEWRNG ( 410 ) /* wrong size */ | +
| #define ESLAST ESLEWRNG | +
| #define EOK ( 0 ) | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This graph shows which files directly or indirectly include this file:+Functions | |
| bool | isExclusion (uint32_t uv) |
| bool | isSingleton (uint32_t uv) |
| bool | isNonStDecomp (uint32_t uv) |
| bool | isComp2nd (uint32_t uv) |
| bool isExclusion | +( | +uint32_t | +uv | ) | ++ |
| bool isSingleton | +( | +uint32_t | +uv | ) | ++ |
| bool isNonStDecomp | +( | +uint32_t | +uv | ) | ++ |
| bool isComp2nd | +( | +uint32_t | +uv | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsncat_s.c:+Functions | |
| EXPORT errno_t | _wcsncat_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for getenv_s.c:+Functions | |
| EXPORT errno_t | _getenv_s_chk (size_t *restrict len, char *restrict dest, rsize_t dmax, const char *restrict name, const size_t destbos) |
| EXPORT errno_t _getenv_s_chk | +( | +size_t *restrict | +len, | +
| + | + | char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +name, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strishex_s.c:+Functions | |
| EXPORT bool | _strishex_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT bool _strishex_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for safe_str_constraint.c:+Functions | |
| EXPORT constraint_handler_t | set_str_constraint_handler_s (constraint_handler_t handler) |
| The set_str_constraint_handler_s function sets the runtime-constraint handler to be handler. More... | |
| EXPORT void | invoke_safe_str_constraint_handler (const char *restrict msg, void *restrict ptr, errno_t error) |
| Invokes the currently set constraint handler or the default. More... | |
| int | handle_str_bos_overload (const char *restrict msg, char *restrict dest, const rsize_t dmax) |
| void | handle_str_bos_chk_warn (const char *restrict func, char *restrict dest, const rsize_t dmax, const size_t destbos) |
| void | handle_str_src_bos_chk_warn (const char *restrict func, char *restrict dest, const rsize_t smax, const size_t srcbos, const char *srcname, const char *smaxname) |
+Variables | |
| static constraint_handler_t | str_handler = NULL |
| EXPORT constraint_handler_t set_str_constraint_handler_s | +( | +constraint_handler_t | +handler | ) | ++ |
The set_str_constraint_handler_s function sets the runtime-constraint handler to be handler.
+The runtime-constraint handler is the function to be called when a library function detects a runtime-constraint violation. Only the most recent handler registered with set_str_constraint_handler_s is called when a runtime-constraint violation occurs. When the handler is called, it is passed the following arguments in the following order:
| EXPORT void invoke_safe_str_constraint_handler | +( | +const char *restrict | +msg, | +
| + | + | void *restrict | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
Invokes the currently set constraint handler or the default.
+Can be disabled via –disable-constraint-handler
| *msg | Pointer to the message describing the error. |
| *ptr | Pointer to aassociated data. Can be NULL. |
| error | The error code encountered. |
| int handle_str_bos_overload | +( | +const char *restrict | +msg, | +
| + | + | char *restrict | +dest, | +
| + | + | const rsize_t | +dmax | +
| + | ) | ++ |
| void handle_str_bos_chk_warn | +( | +const char *restrict | +func, | +
| + | + | char *restrict | +dest, | +
| + | + | const rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| void handle_str_src_bos_chk_warn | +( | +const char *restrict | +func, | +
| + | + | char *restrict | +dest, | +
| + | + | const rsize_t | +smax, | +
| + | + | const size_t | +srcbos, | +
| + | + | const char * | +srcname, | +
| + | + | const char * | +smaxname | +
| + | ) | ++ |
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memset32_s.c:+Functions | |
| EXPORT errno_t | _memset32_s_chk (uint32_t *dest, rsize_t dmax, uint32_t value, rsize_t n, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for ctime_s.c:+Functions | |
| EXPORT errno_t | _ctime_s_chk (char *dest, rsize_t dmax, const time_t *timer, const size_t destbos) |
| EXPORT errno_t _ctime_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const time_t * | +timer, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcmp_s.c:+Functions | |
| EXPORT errno_t | _strcmp_s_chk (const char *dest, rsize_t dmax, const char *src, int *resultp, const size_t destbos, size_t srcbos) |
| EXPORT errno_t _strcmp_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | size_t | +srcbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
C11 defined the optional secure extensions to be demanded by __STDC_WANT_LIB_EXT1__.
From the following tested libc implementations:
+only the last 5 implement the secure C11 extensions:
+Generally most libc's use a 4 byte wchar_t (which resembles UTF-32), but windows/cygwin/solaris/aix use 2-byte (UTF-16), therefore they need to support surrogate pairs.
+The wide sprintf variants do not allow a NULL buffer argument to return the size of the resulting buffer. If the initial buffer is too small, you need to realloc and redo.
+There's still no locale-independent utf8 support, not even in C11 with its new u8"" type.
Many wchar and mb conversions and searches are locale-dependent, hence unusable for utf8.
+Nobody implements a proper wchar case-conversion, foldcase and normalization API. ICU or libunistring are way too heavy for this simple problem. There's only utf8proc for utf8 encoded strings (now with julia).
+See also http://crashcourse.housegordon.org/coreutils-multibyte-support.html
+None of the other libc's (and neither most crypto libraries) provide a secure memory barrier for memset/memzero/memset_s/explicit_bzero/SecureZeroMemory/..., they only provide a compiler barrier against false compiler optimizations. They don't reliably sync memory stores with possibly re-ordered loads by modern out-of-order CPU's. Only the linux kernel and safeclib do so.
+tmpnam_s:
Is considered unsafe. tmpnam_s and tmpnam are racy.
sprintf_s and vsprintf_s retval on errors.
They were revised by the author from Microsoft in n1141 to return 0 on most errors (only -1 on encoding errors), to allow the often used count += sprintf(buf + count, format_string, args); when no encoding errors could occur, ignoring retval < 0 checks. Lateron Microsoft and all other implementors (e.g. Embacadero, safeclib) revised this decision to be consistent, to return -1 on all errors, just the standard still contains the n1141 revision.
fopen_s, freopen_s deviate in the API: restrict is missing.strtok_s, wcstok_s,vsnprintf_s miss the dmax argument.vsnprintf_s adds a maxarg argument.vswprintf adds a maxarg argument on w32. (with __STRICT_ANSI__ undefined)strnlen on mingw32.errno_t return type for qsort_s, only void.localtime_s and gmtime_s.wchar.h with only 2 functions: wcscmp, wcslenRSIZE_MAXmemmove_s does not clear dest with ERANGE when count > dmax and EINVAL when src is a NULL pointer.vsprintf_s, sprintf_s return -1 on all errors, not just encoding errors. (Wrong standard)wcsrtombs (used by wcsrtomb_s) the *retval result includes the terminating zero, i.e. the result is +1 from the spec.scanf_s and printf_s functions. This would need tighter integration into the upstream libc.fgets_s permits temporary writes of dmax+1 characters into dest.vsprintf_s, sprintf_s return -1 on all errors, not just encoding errors. (Wrong standard)Not yet tested. Hard to find as open source. Apparently once implemented as part of the stlport library, but unused and I cannot find it in Bionic (orea), which is mostly an improved FreeBSD libc. stlport had a portable rewrite of the secure Windows API, written in 1999. Now they use just the fortified POSIX API, e.g. for strncpy_s strncpy_chk and __strncpy_chk2 with known src size.
See Wikipedia: Bionic Fortify_source, and their blog post FORTIFY in Android.
+Basically they use a __bos() or __builtin_object_size macro which is a better sizeof and expands to the size of the compile-time pointer when the size of the buffer is known at compile-time. They also try to use the alloc_size extension which looks at a malloc'ed pointer into the previous word for its size. So there's no secure API, just the normal POSIX and glibc API with compile-time _chk checks as in glibc with FORTIFY. Just a bit better than glibc.
Tested by http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm#alternatives It sets the __STDC_LIB_EXT1__ macro to 200509L and can be considered a nearly conforming implementation.
"Slibc is a complete, open source implementation of Annex K designed to be used with GNU C library typically distributed with Linux. The implementation claims to be complete and to fully conform to C11. An inspection of the implementation reveals that it is quite inefficient and thus unsuitable for production use without considerable changes. It does provide a good referefence implementation of the library. A proposal to incorporate slibc into the GNU C library was submitted in 2012 to the GNU C library community and rejected."
+Available at https://code.google.com/archive/p/slibc/
+freopen(NULL, "rb", stdin) with asan on some systems, calling an invalid strlen() on NULL.quirky declaration of various standards, which conflict with each other.
+glibc needs the correct standard to include some extensions when we declare the standard by ourselves. e.g. clang-4.0 -std=c99 misses several reentrant versions. when defining _XOPEN_SOURCE 700 to define strnlen and the reentrant time versions, we need also __STDC_WANT_LIB_EXT1__ 1 for errno_t, and this would break several other older struct members, such as tm_gmtoff
vswscanf is broken with a format string containing L"%%n"vswscanf is broken with a format string containing L"%%n"mbstowcs is broken with ‘(NULL, ’\0')`wmemcmp returns not -1, 0 or 1 but the full ptr diff.mbtowc and wctomb accept and convert illegal 4 byte characters in the ASCII locale to surrogate pairs, as it would be unicode. e.g. it converts \xa0 to \xdfa0.As of wine-2.0.4 its libc has several more errors than the msvcrt sec_api:
+asctime_s with tm->mday=0 returns not EINVAL but 0.wcsncat_s(dest, dmax, src, 0) returns not EINVAL but 0.wcsncat_s(NULL, 0, src, 0); returns not 0 but EINVAL.wcsncat_s: ESUNTERM and ESOVRLP do not clear destwcsrtombs_s(&ind, dest, 0, &cs, 0, &ps) returns not EINVAL but 0, with ind kept at 0. It's now 10 years after the secure libc extensions were designed, C11 adopted them, and still almost nobody implements them. Only for compile-time known sizes the FORTIFY _chk extension secures against overflows, but not against dynamically allocated buffers. This library was written 2008 under the MIT license, thanks Cisco.
Reini Urban 2018
+|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcpyfldout_s.c:+Functions | |
| EXPORT errno_t | _strcpyfldout_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for asctime_s.c:+Functions | |
| EXPORT errno_t | _asctime_s_chk (char *dest, rsize_t dmax, const struct tm *tm, const size_t destbos) |
| EXPORT errno_t _asctime_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const struct tm * | +tm, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for wmemcmp_s.c:+Functions | |
| EXPORT errno_t | _wmemcmp_s_chk (const wchar_t *dest, rsize_t dlen, const wchar_t *src, rsize_t slen, int *diff, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcscmp_s.c:+Functions | |
| EXPORT errno_t | _wcscmp_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, int *resultp, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vsprintf_s.c:+Functions | |
| EXPORT int | _vsprintf_s_chk (char *restrict dest, const rsize_t dmax, const size_t destbos, const char *restrict fmt, va_list ap) |
| EXPORT int _vsprintf_s_chk | +( | +char *restrict | +dest, | +
| + | + | const rsize_t | +dmax, | +
| + | + | const size_t | +destbos, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strispassword_s.c:+Functions | |
| EXPORT bool | _strispassword_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT bool _strispassword_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This graph shows which files directly or indirectly include this file:+Macros | |
| #define | NORMALIZE_IND_TBL |
| #define | UNWIF_canon_MAXLEN 6 |
| #define | TBL(i) ((i-1) << 10) |
| #define | UNWIF_canon_LEN(v) (((v) >> 10) + 1) |
| #define | UNWIF_canon_IDX(v) ((v) & 0x3ff) |
| #define | UNWIF_canon_PLANE_T uint16_t |
+Variables | |
| static const wchar_t | UNWIF_canon_tbl_1 [807][1] |
| static const wchar_t | UNWIF_canon_tbl_2 [856][2] |
| static const wchar_t | UNWIF_canon_tbl_3 [218][3] |
| static const wchar_t | UNWIF_canon_tbl_4 [52][4] |
| static const wchar_t | UNWIF_canon_tbl_6 [9][6] |
| static const wchar_t * | UNWIF_canon_tbl [5] |
| static const uint16_t | UNWIF_canon_00_00 [256] |
| static const uint16_t | UNWIF_canon_00_01 [256] |
| static const uint16_t | UNWIF_canon_00_02 [256] |
| static const uint16_t | UNWIF_canon_00_03 [256] |
| static const uint16_t | UNWIF_canon_00_04 [256] |
| static const uint16_t | UNWIF_canon_00_06 [256] |
| static const uint16_t | UNWIF_canon_00_09 [256] |
| static const uint16_t | UNWIF_canon_00_0a [256] |
| static const uint16_t | UNWIF_canon_00_0b [256] |
| static const uint16_t | UNWIF_canon_00_0c [256] |
| static const uint16_t | UNWIF_canon_00_0d [256] |
| static const uint16_t | UNWIF_canon_00_0f [256] |
| static const uint16_t | UNWIF_canon_00_10 [256] |
| static const uint16_t | UNWIF_canon_00_1b [256] |
| static const uint16_t | UNWIF_canon_00_1e [256] |
| static const uint16_t | UNWIF_canon_00_1f [256] |
| static const uint16_t | UNWIF_canon_00_20 [256] |
| static const uint16_t | UNWIF_canon_00_21 [256] |
| static const uint16_t | UNWIF_canon_00_22 [256] |
| static const uint16_t | UNWIF_canon_00_23 [256] |
| static const uint16_t | UNWIF_canon_00_2a [256] |
| static const uint16_t | UNWIF_canon_00_30 [256] |
| static const uint16_t | UNWIF_canon_00_f9 [256] |
| static const uint16_t | UNWIF_canon_00_fa [256] |
| static const uint16_t | UNWIF_canon_00_fb [256] |
| static const uint16_t | UNWIF_canon_01_10 [256] |
| static const uint16_t | UNWIF_canon_01_11 [256] |
| static const uint16_t | UNWIF_canon_01_13 [256] |
| static const uint16_t | UNWIF_canon_01_14 [256] |
| static const uint16_t | UNWIF_canon_01_15 [256] |
| static const uint16_t | UNWIF_canon_01_d1 [256] |
| static const uint16_t | UNWIF_canon_02_f8 [256] |
| static const uint16_t | UNWIF_canon_02_f9 [256] |
| static const uint16_t | UNWIF_canon_02_fa [256] |
| static const uint16_t * | UNWIF_canon_00 [256] |
| static const uint16_t * | UNWIF_canon_01 [256] |
| static const uint16_t * | UNWIF_canon_02 [256] |
| static const uint16_t ** | UNWIF_canon [] |
| #define NORMALIZE_IND_TBL | +
| #define UNWIF_canon_MAXLEN 6 | +
| #define TBL | +( | ++ | i | ) | +((i-1) << 10) | +
| #define UNWIF_canon_LEN | +( | ++ | v | ) | +(((v) >> 10) + 1) | +
| #define UNWIF_canon_IDX | +( | ++ | v | ) | +((v) & 0x3ff) | +
| #define UNWIF_canon_PLANE_T uint16_t | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strtok_s.c:+Functions | |
| EXPORT char * | _strtok_s_chk (char *restrict dest, rsize_t *restrict dmaxp, const char *restrict delim, char **restrict ptr, const size_t destbos) |
| EXPORT char* _strtok_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t *restrict | +dmaxp, | +
| + | + | const char *restrict | +delim, | +
| + | + | char **restrict | +ptr, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for tmpnam_s.c:+Functions | |
| EXPORT errno_t | _tmpnam_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT errno_t _tmpnam_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for gets_s.c:+Functions | |
| EXPORT char * | _gets_s_chk (char *restrict dest, rsize_t dmax, const size_t destbos) |
| EXPORT char* _gets_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memccpy_s.c:+Functions | |
| EXPORT errno_t | _memccpy_s_chk (void *restrict dest, rsize_t dmax, const void *restrict src, int c, rsize_t n, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for safe_str_constraint.h:
This graph shows which files directly or indirectly include this file:+Functions | |
| EXTERN void | invoke_safe_str_constraint_handler (const char *restrict msg, void *restrict ptr, errno_t error) |
| Invokes the currently set constraint handler or the default. More... | |
| static void | handle_error (char *restrict dest, const rsize_t dmax, const char *restrict err_msg, errno_t err_code) |
| static void | handle_werror (wchar_t *restrict dest, const rsize_t dmax, const char *err_msg, errno_t err_code) |
| int | handle_str_bos_overload (const char *restrict msg, char *restrict dest, const rsize_t dmax) |
| void | handle_str_bos_chk_warn (const char *restrict func, char *restrict dest, const rsize_t dmax, const size_t destbos) |
| void | handle_str_src_bos_chk_warn (const char *restrict func, char *restrict dest, const rsize_t smax, const size_t srcbos, const char *srcname, const char *smaxname) |
| EXTERN void invoke_safe_str_constraint_handler | +( | +const char *restrict | +msg, | +
| + | + | void *restrict | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
Invokes the currently set constraint handler or the default.
+Can be disabled via –disable-constraint-handler
| *msg | Pointer to the message describing the error. |
| *ptr | Pointer to aassociated data. Can be NULL. |
| error | The error code encountered. |
+
|
+ +inlinestatic | +
+
|
+ +inlinestatic | +
| int handle_str_bos_overload | +( | +const char *restrict | +msg, | +
| + | + | char *restrict | +dest, | +
| + | + | const rsize_t | +dmax | +
| + | ) | ++ |
| void handle_str_bos_chk_warn | +( | +const char *restrict | +func, | +
| + | + | char *restrict | +dest, | +
| + | + | const rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| void handle_str_src_bos_chk_warn | +( | +const char *restrict | +func, | +
| + | + | char *restrict | +dest, | +
| + | + | const rsize_t | +smax, | +
| + | + | const size_t | +srcbos, | +
| + | + | const char * | +srcname, | +
| + | + | const char * | +smaxname | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strncpy_s.c:+Functions | |
| EXPORT errno_t | _strncpy_s_chk (char *restrict dest, rsize_t dmax, const char *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Include dependency graph for qsort_s.c:+Macros | |
| #define | ntz(x) a_ctz_l((x)) |
+Typedefs | |
| typedef unsigned long | uint64_t |
| typedef int(* | cmpfun) (const void *, const void *, void *) |
+Functions | |
| static int | a_ctz_64 (uint64_t x) |
| static int | a_ctz_l (unsigned long x) |
| static int | pntz (size_t p[2]) |
| static void | cycle (size_t width, unsigned char *ar[], int n) |
| static void | shl (size_t p[2], int n) |
| static void | shr (size_t p[2], int n) |
| static void | sift (unsigned char *head, size_t width, cmpfun cmp, int pshift, size_t lp[], void *ctx) |
| static void | trinkle (unsigned char *head, size_t width, cmpfun cmp, size_t pp[2], int pshift, int trusty, size_t lp[], void *ctx) |
| static void | qsort_musl (void *base, size_t nel, size_t width, cmpfun cmp, void *ctx) |
| EXPORT errno_t | _qsort_s_chk (void *base, rsize_t nmemb, rsize_t size, int(*compar)(const void *k, const void *y, void *context), void *context, const size_t destbos) |
+Variables | |
| static const char | debruijn32 [32] |
| #define ntz | +( | ++ | x | ) | +a_ctz_l((x)) | +
| typedef unsigned long uint64_t | +
| typedef int(* cmpfun) (const void *, const void *, void *) | +
+
|
+ +inlinestatic | +
+
|
+ +inlinestatic | +
+
|
+ +inlinestatic | +
+
|
+ +static | +
+
|
+ +inlinestatic | +
+
|
+ +inlinestatic | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
| EXPORT errno_t _qsort_s_chk | +( | +void * | +base, | +
| + | + | rsize_t | +nmemb, | +
| + | + | rsize_t | +size, | +
| + | + | int(*)(const void *k, const void *y, void *context) | +compar, | +
| + | + | void * | +context, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strprefix_s.c:+Functions | |
| EXPORT errno_t | _strprefix_s_chk (const char *dest, rsize_t dmax, const char *src, const size_t destbos) |
| EXPORT errno_t _strprefix_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsrtombs_s.c:+Functions | |
| EXPORT errno_t | _wcsrtombs_s_chk (size_t *restrict retvalp, char *restrict dest, rsize_t dmax, const wchar_t **restrict srcp, rsize_t len, mbstate_t *restrict ps, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strremovews_s.c:+Functions | |
| EXPORT errno_t | _strremovews_s_chk (char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT errno_t _strremovews_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memcmp16_s.c:+Functions | |
| EXPORT errno_t | _memcmp16_s_chk (const uint16_t *dest, rsize_t dlen, const uint16_t *src, rsize_t slen, int *diff, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strfirstchar_s.c:+Functions | |
| EXPORT errno_t | _strfirstchar_s_chk (char *dest, rsize_t dmax, char c, char **firstp, const size_t destbos) |
| EXPORT errno_t _strfirstchar_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | char | +c, | +
| + | + | char ** | +firstp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strtolowercase_s.c:+Functions | |
| EXPORT errno_t | _strtolowercase_s_chk (char *restrict dest, rsize_t dmax, const size_t destbos) |
| EXPORT errno_t _strtolowercase_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for sprintf_s.c:+Functions | |
| EXPORT int | sprintf_s (char *restrict dest, rsize_t dmax, const char *restrict fmt,...) |
| EXPORT int sprintf_s | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for fwscanf_s.c:+Functions | |
| EXPORT int | fwscanf_s (FILE *restrict stream, const wchar_t *restrict fmt,...) |
The fwscanf_s function reads a formatted wide string. More... | |
| EXPORT int fwscanf_s | +( | +FILE *restrict | +stream, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The fwscanf_s function reads a formatted wide string.
Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf.
| [in] | stream | pointer to a FILE stream to read from |
| [in] | fmt | format-control wide string. |
| [out] | ... | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) Note it currently even crashes with a NULL pointer. c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strset_s.c:+Functions | |
| EXPORT errno_t | _strset_s_chk (char *restrict dest, rsize_t dmax, int value, const size_t destbos) |
| EXPORT errno_t _strset_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | int | +value, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"#include "unw16ifcan.h"#include "unw16ifcmb.h"#include "unw16ifcmp.h"#include "unw16ifexc.h"#include "hangul.h"
Include dependency graph for wcsnorm_s.c:+Data Structures | |
| struct | UNWIF_cc |
+Macros | |
| #define | _UNICODE_MAX 0x10ffff |
| #define | CC_SEQ_SIZE 10 |
| #define | CC_SEQ_STEP 5 |
+Functions | |
| bool | isExclusion (uint32_t uv) |
| bool | isSingleton (uint32_t uv) |
| bool | isNonStDecomp (uint32_t uv) |
| bool | isComp2nd (uint32_t uv) |
| static int | _decomp_canonical_s (wchar_t *dest, rsize_t dmax, uint32_t cp) |
| static int | _decomp_hangul_s (wchar_t *dest, rsize_t dmax, uint32_t cp) |
| EXPORT int | _decomp_s (wchar_t *restrict dest, rsize_t dmax, const uint32_t cp, const bool iscompat) |
| static int | _compare_cc (const void *a, const void *b) |
| static uint32_t | _composite_cp (uint32_t cp, uint32_t cp2) |
| static uint8_t | _combin_class (uint32_t cp) |
| EXPORT errno_t | _wcsnorm_decompose_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t *restrict lenp, const bool iscompat, const size_t destbos) |
| EXPORT errno_t | _wcsnorm_reorder_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, const rsize_t len, const size_t destbos) |
| EXPORT errno_t | _wcsnorm_compose_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t *restrict lenp, const bool iscontig, const size_t destbos) |
| EXPORT errno_t | _wcsnorm_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, const wcsnorm_mode_t mode, rsize_t *restrict lenp, const size_t destbos) |
| #define _UNICODE_MAX 0x10ffff | +
| #define CC_SEQ_SIZE 10 | +
| #define CC_SEQ_STEP 5 | +
| bool isExclusion | +( | +uint32_t | +uv | ) | ++ |
| bool isSingleton | +( | +uint32_t | +uv | ) | ++ |
| bool isNonStDecomp | +( | +uint32_t | +uv | ) | ++ |
| bool isComp2nd | +( | +uint32_t | +uv | ) | ++ |
+
|
+ +static | +
+
|
+ +static | +
| EXPORT int _decomp_s | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const uint32_t | +cp, | +
| + | + | const bool | +iscompat | +
| + | ) | ++ |
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
| EXPORT errno_t _wcsnorm_decompose_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t *restrict | +lenp, | +
| + | + | const bool | +iscompat, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXPORT errno_t _wcsnorm_reorder_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | const rsize_t | +len, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXPORT errno_t _wcsnorm_compose_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t *restrict | +lenp, | +
| + | + | const bool | +iscontig, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This graph shows which files directly or indirectly include this file:+Macros | |
| #define | RSIZE_MAX_MEM (256UL << 20) /* 256MB */ |
| #define | RSIZE_MAX_STR (4UL << 10) /* 4KB */ |
| #define | SAFECLIB_STR_NULL_SLACK 1 |
| #define | SAFECLIB_ENABLE_UNSAFE 1 |
| #define | HAVE___BUILTIN_OBJECT_SIZE 1 |
| #define | HAVE___BUILTIN_CONSTANT_P 1 |
| #define | STRTOK_DELIM_MAX_LEN 16 |
| #define RSIZE_MAX_MEM (256UL << 20) /* 256MB */ | +
| #define RSIZE_MAX_STR (4UL << 10) /* 4KB */ | +
| #define SAFECLIB_STR_NULL_SLACK 1 | +
| #define SAFECLIB_ENABLE_UNSAFE 1 | +
| #define HAVE___BUILTIN_OBJECT_SIZE 1 | +
| #define HAVE___BUILTIN_CONSTANT_P 1 | +
| #define STRTOK_DELIM_MAX_LEN 16 | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strchr_s.c:+Functions | |
| EXPORT errno_t | _strchr_s_chk (const char *restrict dest, rsize_t dmax, const int ch, char **restrict resultp, const size_t destbos) |
| EXPORT errno_t _strchr_s_chk | +( | +const char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const int | +ch, | +
| + | + | char **restrict | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vfwscanf_s.c:+Functions | |
| EXPORT int | vfwscanf_s (FILE *restrict stream, const wchar_t *restrict fmt, va_list ap) |
The vfwscanf_s function reads a formatted wide string. More... | |
| EXPORT int vfwscanf_s | +( | +FILE *restrict | +stream, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vfwscanf_s function reads a formatted wide string.
Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf.
| [in] | stream | pointer to a FILE stream to read from |
| [in] | fmt | format-control wide string. |
| [out] | ap | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wprintf_s.c:+Functions | |
| EXPORT int | wprintf_s (const wchar_t *restrict fmt,...) |
| The wprintf_s function prints formatted output to stdout as wide string. More... | |
| EXPORT int wprintf_s | +( | +const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The wprintf_s function prints formatted output to stdout as wide string.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vwprintf call fails, errno is set.| [in] | fmt | format-control wide string. |
| [in] | ... | optional arguments |
n s is a null pointer (not yet) | -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | some other error. errno: EINVAL or EOVERFLOW |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for vsscanf_s.c:+Functions | |
| EXPORT int | vsscanf_s (const char *restrict buffer, const char *restrict fmt, va_list ap) |
The vsscanf_s function reads a formatted string, and writes to a list of arguments. More... | |
| EXPORT int vsscanf_s | +( | +const char *restrict | +buffer, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vsscanf_s function reads a formatted string, and writes to a list of arguments.
Reaching the end of the string is equivalent to reaching the end-of-file condition for fscanf.
| [in] | buffer | pointer to a null-terminated string to read from |
| [in] | fmt | format-control string. |
| [out] | ap | arguments to write to |
buffer nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for swprintf_s.c:+Functions | |
| EXPORT int | swprintf_s (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict fmt,...) |
| EXPORT int swprintf_s | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcoll_s.c:+Functions | |
| EXPORT errno_t | _strcoll_s_chk (const char *restrict dest, rsize_t dmax, const char *restrict src, int *resultp, const size_t destbos) |
| EXPORT errno_t _strcoll_s_chk | +( | +const char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strnatcmp_s.c:+Functions | |
| static int | compare_right (char const *a, char const *b) |
| static int | compare_left (char const *a, char const *b) |
| EXPORT errno_t | _strnatcmp_s_chk (const char *dest, rsize_t dmax, const char *src, const int fold_case, int *resultp, const size_t destbos, const size_t srcbos) |
+
|
+ +static | +
+
|
+ +static | +
| EXPORT errno_t _strnatcmp_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | const int | +fold_case, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for printf_s.c:+Functions | |
| EXPORT int | printf_s (const char *restrict fmt,...) |
| The printf_s function composes a string via the format string and writes it to a FILE buffer. More... | |
| EXPORT int printf_s | +( | +const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The printf_s function composes a string via the format string and writes it to a FILE buffer.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vprintf call fails, errno is set.| [in] | fmt | format-control string |
| [in] | ... | optional arguments |
| -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then. |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include <linux/module.h>#include <linux/kernel.h>#include "../safeclib_private.h"
Include dependency graph for slkm_init.c:+Macros | |
| #define | DRV_NAME "slk" |
| #define | DRV_VERSION "0.0" |
| #define | DRV_DESCRIPTION "Safe C Library Kernel Module" |
| #define | DRV_COPYRIGHT "Copyright(c) 2012 cisco Systems, Inc." |
+Functions | |
| MODULE_DESCRIPTION (DRV_DESCRIPTION) | |
| MODULE_AUTHOR (DRV_COPYRIGHT) | |
| MODULE_LICENSE ("MIT") | |
| MODULE_VERSION (DRV_VERSION) | |
| MODULE_ALIAS ("slk") | |
| static int __init | slk_init (void) |
| Module initialization function. More... | |
| static void __exit | slk_exit (void) |
| Module exit function. More... | |
| module_init (slk_init) | |
| module_exit (slk_exit) | |
| #define DRV_NAME "slk" | +
| #define DRV_VERSION "0.0" | +
| #define DRV_DESCRIPTION "Safe C Library Kernel Module" | +
| #define DRV_COPYRIGHT "Copyright(c) 2012 cisco Systems, Inc." | +
| MODULE_DESCRIPTION | +( | +DRV_DESCRIPTION | +) | ++ |
| MODULE_AUTHOR | +( | +DRV_COPYRIGHT | +) | ++ |
| MODULE_LICENSE | +( | +"MIT" | +) | ++ |
| MODULE_VERSION | +( | +DRV_VERSION | +) | ++ |
| MODULE_ALIAS | +( | +"slk" | +) | ++ |
+
|
+ +static | +
Module initialization function.
+
+
|
+ +static | +
Module exit function.
+ +| module_init | +( | +slk_init | +) | ++ |
| module_exit | +( | +slk_exit | +) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strtouppercase_s.c:+Functions | |
| EXPORT errno_t | _strtouppercase_s_chk (char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT errno_t _strtouppercase_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcasecmp_s.c:+Functions | |
| EXPORT errno_t | _strcasecmp_s_chk (const char *dest, rsize_t dmax, const char *src, int *resultp, const size_t destbos) |
| EXPORT errno_t _strcasecmp_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for safe_mem_constraint.h:
This graph shows which files directly or indirectly include this file:+Functions | |
| EXTERN void | invoke_safe_mem_constraint_handler (const char *msg, void *ptr, errno_t error) |
| Invokes the currently set constraint handler or the default. More... | |
| static void | handle_mem_error (void *restrict dest, rsize_t dmax, const char *err_msg, errno_t err_code) |
| void | handle_mem_bos_chk_warn (const char *restrict func, void *restrict dest, const rsize_t dmax, const size_t destbos) |
| EXTERN void invoke_safe_mem_constraint_handler | +( | +const char * | +msg, | +
| + | + | void * | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
Invokes the currently set constraint handler or the default.
+Can be disabled via –disable-constraint-handler
| *msg | Pointer to the message describing the error. |
| *ptr | Pointer to associated data. Can be NULL. |
| error | The error code encountered. |
+
|
+ +inlinestatic | +
| void handle_mem_bos_chk_warn | +( | +const char *restrict | +func, | +
| + | + | void *restrict | +dest, | +
| + | + | const rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for sscanf_s.c:+Functions | |
| EXPORT int | sscanf_s (const char *restrict buffer, const char *restrict fmt,...) |
The sscanf_s function reads a formatted string, and writes to a list of arguments. More... | |
| EXPORT int sscanf_s | +( | +const char *restrict | +buffer, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The sscanf_s function reads a formatted string, and writes to a list of arguments.
Reaching the end of the string is equivalent to reaching the end-of-file condition for fscanf.
| [in] | buffer | pointer to a null-terminated string to read from |
| [in] | fmt | format-control string. |
| [out] | ... | arguments to write to |
buffer nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for vfscanf_s.c:+Functions | |
| EXPORT int | vfscanf_s (FILE *restrict stream, const char *restrict fmt, va_list ap) |
The vfscanf_s function reads a formatted string from a buffered FILE stream, and writes to a list of arguments. More... | |
| EXPORT int vfscanf_s | +( | +FILE *restrict | +stream, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vfscanf_s function reads a formatted string from a buffered FILE stream, and writes to a list of arguments.
| [in] | stream | pointer to a FILE stream to read from |
| [in] | fmt | format-control string. |
| [out] | ap | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vfwprintf_s.c:+Functions | |
| EXPORT int | vfwprintf_s (FILE *restrict stream, const wchar_t *restrict fmt, va_list ap) |
| The vfwprintf_s function prints formatted output to a wide stream. More... | |
| EXPORT int vfwprintf_s | +( | +FILE *restrict | +stream, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vfwprintf_s function prints formatted output to a wide stream.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vfwprintf call fails, errno is set.| [in] | stream | output wide stream to write to |
| [in] | fmt | format-control wide string. |
| [in] | ap | optional arguments |
n s is a null pointer (not yet) | -ESNULLP | when stream or fmt is a NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | some other error. errno: EINVAL or EOVERFLOW |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Data Structures | |
| struct | UNWIF_compat_exc_t |
+Macros | |
| #define | NORMALIZE_IND_TBL |
| #define | UNWIF_compat_MAXLEN 5 |
| #define | TBL(i) ((i-1) << 11) |
| #define | UNWIF_compat_LEN(v) (((v) >> 11) + 1) |
| #define | UNWIF_compat_IDX(v) ((v) & 0x7ff) |
| #define | UNWIF_compat_PLANE_T uint16_t |
| #define | UNWIF_compat_exc_size 26 |
+Variables | |
| static const wchar_t | UNWIF_compat_tbl_1 [1555][1] |
| static const wchar_t | UNWIF_compat_tbl_2 [1284][2] |
| static const wchar_t | UNWIF_compat_tbl_3 [629][3] |
| static const wchar_t | UNWIF_compat_tbl_4 [125][4] |
| static const wchar_t | UNWIF_compat_tbl_5 [16][5] |
| static const UNWIF_compat_exc_t | UNWIF_compat_exc [26] |
| static const wchar_t * | UNWIF_compat_tbl [5] |
| static const uint16_t | UNWIF_compat_00_00 [256] |
| static const uint16_t | UNWIF_compat_00_01 [256] |
| static const uint16_t | UNWIF_compat_00_02 [256] |
| static const uint16_t | UNWIF_compat_00_03 [256] |
| static const uint16_t | UNWIF_compat_00_04 [256] |
| static const uint16_t | UNWIF_compat_00_05 [256] |
| static const uint16_t | UNWIF_compat_00_06 [256] |
| static const uint16_t | UNWIF_compat_00_09 [256] |
| static const uint16_t | UNWIF_compat_00_0a [256] |
| static const uint16_t | UNWIF_compat_00_0b [256] |
| static const uint16_t | UNWIF_compat_00_0c [256] |
| static const uint16_t | UNWIF_compat_00_0d [256] |
| static const uint16_t | UNWIF_compat_00_0e [256] |
| static const uint16_t | UNWIF_compat_00_0f [256] |
| static const uint16_t | UNWIF_compat_00_10 [256] |
| static const uint16_t | UNWIF_compat_00_1b [256] |
| static const uint16_t | UNWIF_compat_00_1d [256] |
| static const uint16_t | UNWIF_compat_00_1e [256] |
| static const uint16_t | UNWIF_compat_00_1f [256] |
| static const uint16_t | UNWIF_compat_00_20 [256] |
| static const uint16_t | UNWIF_compat_00_21 [256] |
| static const uint16_t | UNWIF_compat_00_22 [256] |
| static const uint16_t | UNWIF_compat_00_23 [256] |
| static const uint16_t | UNWIF_compat_00_24 [256] |
| static const uint16_t | UNWIF_compat_00_2a [256] |
| static const uint16_t | UNWIF_compat_00_2c [256] |
| static const uint16_t | UNWIF_compat_00_2d [256] |
| static const uint16_t | UNWIF_compat_00_2e [256] |
| static const uint16_t | UNWIF_compat_00_2f [256] |
| static const uint16_t | UNWIF_compat_00_30 [256] |
| static const uint16_t | UNWIF_compat_00_31 [256] |
| static const uint16_t | UNWIF_compat_00_32 [256] |
| static const uint16_t | UNWIF_compat_00_33 [256] |
| static const uint16_t | UNWIF_compat_00_a6 [256] |
| static const uint16_t | UNWIF_compat_00_a7 [256] |
| static const uint16_t | UNWIF_compat_00_ab [256] |
| static const uint16_t | UNWIF_compat_00_f9 [256] |
| static const uint16_t | UNWIF_compat_00_fa [256] |
| static const uint16_t | UNWIF_compat_00_fb [256] |
| static const uint16_t | UNWIF_compat_00_fc [256] |
| static const uint16_t | UNWIF_compat_00_fd [256] |
| static const uint16_t | UNWIF_compat_00_fe [256] |
| static const uint16_t | UNWIF_compat_00_ff [256] |
| static const uint16_t | UNWIF_compat_01_10 [256] |
| static const uint16_t | UNWIF_compat_01_11 [256] |
| static const uint16_t | UNWIF_compat_01_13 [256] |
| static const uint16_t | UNWIF_compat_01_14 [256] |
| static const uint16_t | UNWIF_compat_01_15 [256] |
| static const uint16_t | UNWIF_compat_01_d1 [256] |
| static const uint16_t | UNWIF_compat_01_d4 [256] |
| static const uint16_t | UNWIF_compat_01_d5 [256] |
| static const uint16_t | UNWIF_compat_01_d6 [256] |
| static const uint16_t | UNWIF_compat_01_d7 [256] |
| static const uint16_t | UNWIF_compat_01_ee [256] |
| static const uint16_t | UNWIF_compat_01_f1 [256] |
| static const uint16_t | UNWIF_compat_01_f2 [256] |
| static const uint16_t | UNWIF_compat_02_f8 [256] |
| static const uint16_t | UNWIF_compat_02_f9 [256] |
| static const uint16_t | UNWIF_compat_02_fa [256] |
| static const uint16_t * | UNWIF_compat_00 [256] |
| static const uint16_t * | UNWIF_compat_01 [256] |
| static const uint16_t * | UNWIF_compat_02 [256] |
| static const uint16_t ** | UNWIF_compat [] |
| #define NORMALIZE_IND_TBL | +
| #define UNWIF_compat_MAXLEN 5 | +
| #define TBL | +( | ++ | i | ) | +((i-1) << 11) | +
| #define UNWIF_compat_LEN | +( | ++ | v | ) | +(((v) >> 11) + 1) | +
| #define UNWIF_compat_IDX | +( | ++ | v | ) | +((v) & 0x7ff) | +
| #define UNWIF_compat_PLANE_T uint16_t | +
| #define UNWIF_compat_exc_size 26 | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for timingsafe_memcmp.c:+Functions | |
| EXPORT int | _timingsafe_memcmp_chk (const void *b1, const void *b2, size_t len, const size_t destbos, const size_t srcbos) |
| EXPORT int _timingsafe_memcmp_chk | +( | +const void * | +b1, | +
| + | + | const void * | +b2, | +
| + | + | size_t | +len, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Data Structures | |
| struct | UNWIF_compat_exc_t |
+Macros | |
| #define | NORMALIZE_IND_TBL |
| #define | UNWIF_compat_MAXLEN 5 |
| #define | TBL(i) ((i-1) << 11) |
| #define | UNWIF_compat_LEN(v) (((v) >> 11) + 1) |
| #define | UNWIF_compat_IDX(v) ((v) & 0x7ff) |
| #define | UNWIF_compat_PLANE_T uint16_t |
| #define | UNWIF_compat_exc_size 17 |
+Variables | |
| static const wchar_t | UNWIF_compat_tbl_1 [1665][1] |
| static const wchar_t | UNWIF_compat_tbl_2 [1190][2] |
| static const wchar_t | UNWIF_compat_tbl_3 [638][3] |
| static const wchar_t | UNWIF_compat_tbl_4 [109][4] |
| static const wchar_t | UNWIF_compat_tbl_5 [16][5] |
| static const UNWIF_compat_exc_t | UNWIF_compat_exc [17] |
| static const wchar_t * | UNWIF_compat_tbl [5] |
| static const uint16_t | UNWIF_compat_00_00 [256] |
| static const uint16_t | UNWIF_compat_00_01 [256] |
| static const uint16_t | UNWIF_compat_00_02 [256] |
| static const uint16_t | UNWIF_compat_00_03 [256] |
| static const uint16_t | UNWIF_compat_00_04 [256] |
| static const uint16_t | UNWIF_compat_00_05 [256] |
| static const uint16_t | UNWIF_compat_00_06 [256] |
| static const uint16_t | UNWIF_compat_00_09 [256] |
| static const uint16_t | UNWIF_compat_00_0a [256] |
| static const uint16_t | UNWIF_compat_00_0b [256] |
| static const uint16_t | UNWIF_compat_00_0c [256] |
| static const uint16_t | UNWIF_compat_00_0d [256] |
| static const uint16_t | UNWIF_compat_00_0e [256] |
| static const uint16_t | UNWIF_compat_00_0f [256] |
| static const uint16_t | UNWIF_compat_00_10 [256] |
| static const uint16_t | UNWIF_compat_00_1b [256] |
| static const uint16_t | UNWIF_compat_00_1d [256] |
| static const uint16_t | UNWIF_compat_00_1e [256] |
| static const uint16_t | UNWIF_compat_00_1f [256] |
| static const uint16_t | UNWIF_compat_00_20 [256] |
| static const uint16_t | UNWIF_compat_00_21 [256] |
| static const uint16_t | UNWIF_compat_00_22 [256] |
| static const uint16_t | UNWIF_compat_00_23 [256] |
| static const uint16_t | UNWIF_compat_00_24 [256] |
| static const uint16_t | UNWIF_compat_00_2a [256] |
| static const uint16_t | UNWIF_compat_00_2c [256] |
| static const uint16_t | UNWIF_compat_00_2d [256] |
| static const uint16_t | UNWIF_compat_00_2e [256] |
| static const uint16_t | UNWIF_compat_00_2f [256] |
| static const uint16_t | UNWIF_compat_00_30 [256] |
| static const uint16_t | UNWIF_compat_00_31 [256] |
| static const uint16_t | UNWIF_compat_00_32 [256] |
| static const uint16_t | UNWIF_compat_00_33 [256] |
| static const uint16_t | UNWIF_compat_00_a6 [256] |
| static const uint16_t | UNWIF_compat_00_a7 [256] |
| static const uint16_t | UNWIF_compat_00_ab [256] |
| static const uint16_t | UNWIF_compat_00_f9 [256] |
| static const uint16_t | UNWIF_compat_00_fa [256] |
| static const uint16_t | UNWIF_compat_00_fb [256] |
| static const uint16_t | UNWIF_compat_00_fc [256] |
| static const uint16_t | UNWIF_compat_00_fd [256] |
| static const uint16_t | UNWIF_compat_00_fe [256] |
| static const uint16_t | UNWIF_compat_00_ff [256] |
| static const uint16_t | UNWIF_compat_01_10 [256] |
| static const uint16_t | UNWIF_compat_01_11 [256] |
| static const uint16_t | UNWIF_compat_01_13 [256] |
| static const uint16_t | UNWIF_compat_01_14 [256] |
| static const uint16_t | UNWIF_compat_01_15 [256] |
| static const uint16_t | UNWIF_compat_01_d1 [256] |
| static const uint16_t | UNWIF_compat_01_d4 [256] |
| static const uint16_t | UNWIF_compat_01_d5 [256] |
| static const uint16_t | UNWIF_compat_01_d6 [256] |
| static const uint16_t | UNWIF_compat_01_d7 [256] |
| static const uint16_t | UNWIF_compat_01_ee [256] |
| static const uint16_t | UNWIF_compat_01_f1 [256] |
| static const uint16_t | UNWIF_compat_01_f2 [256] |
| static const uint16_t | UNWIF_compat_02_f8 [256] |
| static const uint16_t | UNWIF_compat_02_f9 [256] |
| static const uint16_t | UNWIF_compat_02_fa [256] |
| static const uint16_t * | UNWIF_compat_00 [256] |
| static const uint16_t * | UNWIF_compat_01 [256] |
| static const uint16_t * | UNWIF_compat_02 [256] |
| static const uint16_t ** | UNWIF_compat [] |
| #define NORMALIZE_IND_TBL | +
| #define UNWIF_compat_MAXLEN 5 | +
| #define TBL | +( | ++ | i | ) | +((i-1) << 11) | +
| #define UNWIF_compat_LEN | +( | ++ | v | ) | +(((v) >> 11) + 1) | +
| #define UNWIF_compat_IDX | +( | ++ | v | ) | +((v) & 0x7ff) | +
| #define UNWIF_compat_PLANE_T uint16_t | +
| #define UNWIF_compat_exc_size 17 | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strfirstsame_s.c:+Functions | |
| EXPORT errno_t | _strfirstsame_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t *resultp, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This graph shows which files directly or indirectly include this file:+Variables | |
| static const uint8_t | UNWIF_combin_00_03 [256] |
| static const uint8_t | UNWIF_combin_00_04 [256] |
| static const uint8_t | UNWIF_combin_00_05 [256] |
| static const uint8_t | UNWIF_combin_00_06 [256] |
| static const uint8_t | UNWIF_combin_00_07 [256] |
| static const uint8_t | UNWIF_combin_00_08 [256] |
| static const uint8_t | UNWIF_combin_00_09 [256] |
| static const uint8_t | UNWIF_combin_00_0a [256] |
| static const uint8_t | UNWIF_combin_00_0b [256] |
| static const uint8_t | UNWIF_combin_00_0c [256] |
| static const uint8_t | UNWIF_combin_00_0d [256] |
| static const uint8_t | UNWIF_combin_00_0e [256] |
| static const uint8_t | UNWIF_combin_00_0f [256] |
| static const uint8_t | UNWIF_combin_00_10 [256] |
| static const uint8_t | UNWIF_combin_00_13 [256] |
| static const uint8_t | UNWIF_combin_00_17 [256] |
| static const uint8_t | UNWIF_combin_00_18 [256] |
| static const uint8_t | UNWIF_combin_00_19 [256] |
| static const uint8_t | UNWIF_combin_00_1a [256] |
| static const uint8_t | UNWIF_combin_00_1b [256] |
| static const uint8_t | UNWIF_combin_00_1c [256] |
| static const uint8_t | UNWIF_combin_00_1d [256] |
| static const uint8_t | UNWIF_combin_00_20 [256] |
| static const uint8_t | UNWIF_combin_00_2c [256] |
| static const uint8_t | UNWIF_combin_00_2d [256] |
| static const uint8_t | UNWIF_combin_00_30 [256] |
| static const uint8_t | UNWIF_combin_00_a6 [256] |
| static const uint8_t | UNWIF_combin_00_a8 [256] |
| static const uint8_t | UNWIF_combin_00_a9 [256] |
| static const uint8_t | UNWIF_combin_00_aa [256] |
| static const uint8_t | UNWIF_combin_00_ab [256] |
| static const uint8_t | UNWIF_combin_00_fb [256] |
| static const uint8_t | UNWIF_combin_00_fe [256] |
| static const uint8_t | UNWIF_combin_01_01 [256] |
| static const uint8_t | UNWIF_combin_01_02 [256] |
| static const uint8_t | UNWIF_combin_01_03 [256] |
| static const uint8_t | UNWIF_combin_01_0a [256] |
| static const uint8_t | UNWIF_combin_01_10 [256] |
| static const uint8_t | UNWIF_combin_01_11 [256] |
| static const uint8_t | UNWIF_combin_01_12 [256] |
| static const uint8_t | UNWIF_combin_01_13 [256] |
| static const uint8_t | UNWIF_combin_01_14 [256] |
| static const uint8_t | UNWIF_combin_01_15 [256] |
| static const uint8_t | UNWIF_combin_01_16 [256] |
| static const uint8_t | UNWIF_combin_01_17 [256] |
| static const uint8_t | UNWIF_combin_01_1a [256] |
| static const uint8_t | UNWIF_combin_01_1c [256] |
| static const uint8_t | UNWIF_combin_01_1d [256] |
| static const uint8_t | UNWIF_combin_01_6a [256] |
| static const uint8_t | UNWIF_combin_01_6b [256] |
| static const uint8_t | UNWIF_combin_01_bc [256] |
| static const uint8_t | UNWIF_combin_01_d1 [256] |
| static const uint8_t | UNWIF_combin_01_d2 [256] |
| static const uint8_t | UNWIF_combin_01_e0 [256] |
| static const uint8_t | UNWIF_combin_01_e8 [256] |
| static const uint8_t | UNWIF_combin_01_e9 [256] |
| static const uint8_t * | UNWIF_combin_00 [256] |
| static const uint8_t * | UNWIF_combin_01 [256] |
| static const uint8_t ** | UNWIF_combin [] |
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcstombs_s.c:+Functions | |
| EXPORT errno_t | _wcstombs_s_chk (size_t *restrict retvalp, char *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t len, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This graph shows which files directly or indirectly include this file:+Macros | |
| #define | Hangul_SBase 0xAC00 |
| #define | Hangul_SFinal 0xD7A3 |
| #define | Hangul_SCount 11172 |
| #define | Hangul_NCount 588 |
| #define | Hangul_LBase 0x1100 |
| #define | Hangul_LFinal 0x1112 |
| #define | Hangul_LCount 19 |
| #define | Hangul_VBase 0x1161 |
| #define | Hangul_VFinal 0x1175 |
| #define | Hangul_VCount 21 |
| #define | Hangul_TBase 0x11A7 |
| #define | Hangul_TFinal 0x11C2 |
| #define | Hangul_TCount 28 |
| #define | Hangul_IsS(u) ((Hangul_SBase <= (u)) && ((u) <= Hangul_SFinal)) |
| #define | Hangul_IsN(u) (((u) - Hangul_SBase) % Hangul_TCount == 0) |
| #define | Hangul_IsLV(u) (Hangul_IsS(u) && Hangul_IsN(u)) |
| #define | Hangul_IsL(u) ((Hangul_LBase <= (u)) && ((u) <= Hangul_LFinal)) |
| #define | Hangul_IsV(u) ((Hangul_VBase <= (u)) && ((u) <= Hangul_VFinal)) |
| #define | Hangul_IsT(u) ((Hangul_TBase < (u)) && ((u) <= Hangul_TFinal)) |
| #define | is_HANGUL_cp_high(cp) |
| #define Hangul_SBase 0xAC00 | +
| #define Hangul_SFinal 0xD7A3 | +
| #define Hangul_SCount 11172 | +
| #define Hangul_NCount 588 | +
| #define Hangul_LBase 0x1100 | +
| #define Hangul_LFinal 0x1112 | +
| #define Hangul_LCount 19 | +
| #define Hangul_VBase 0x1161 | +
| #define Hangul_VFinal 0x1175 | +
| #define Hangul_VCount 21 | +
| #define Hangul_TBase 0x11A7 | +
| #define Hangul_TFinal 0x11C2 | +
| #define Hangul_TCount 28 | +
| #define Hangul_IsS | +( | ++ | u | ) | +((Hangul_SBase <= (u)) && ((u) <= Hangul_SFinal)) | +
| #define Hangul_IsN | +( | ++ | u | ) | +(((u) - Hangul_SBase) % Hangul_TCount == 0) | +
| #define Hangul_IsLV | +( | ++ | u | ) | +(Hangul_IsS(u) && Hangul_IsN(u)) | +
| #define Hangul_IsL | +( | ++ | u | ) | +((Hangul_LBase <= (u)) && ((u) <= Hangul_LFinal)) | +
| #define Hangul_IsV | +( | ++ | u | ) | +((Hangul_VBase <= (u)) && ((u) <= Hangul_VFinal)) | +
| #define Hangul_IsT | +( | ++ | u | ) | +((Hangul_TBase < (u)) && ((u) <= Hangul_TFinal)) | +
| #define is_HANGUL_cp_high | +( | ++ | cp | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wscanf_s.c:+Functions | |
| EXPORT int | wscanf_s (const wchar_t *restrict fmt,...) |
The wscanf_s function reads a formatted wide string from stdin. More... | |
| EXPORT int wscanf_s | +( | +const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The wscanf_s function reads a formatted wide string from stdin.
Reaching the end of the stdin buffer is equivalent to reaching the end-of-file condition for wscanf.
| [in] | fmt | format-control wide string. |
| [out] | ... | arguments to write to |
fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memzero16_s.c:+Functions | |
| EXPORT errno_t | _memzero16_s_chk (uint16_t *dest, rsize_t len, const size_t destbos) |
| EXPORT errno_t _memzero16_s_chk | +( | +uint16_t * | +dest, | +
| + | + | rsize_t | +len, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcmpfld_s.c:+Functions | |
| EXPORT errno_t | _strcmpfld_s_chk (const char *dest, rsize_t dmax, const char *src, int *resultp, const size_t destbos) |
| EXPORT errno_t _strcmpfld_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Variables | |
| static const uint8_t | UNWIF_combin_00_03 [256] |
| static const uint8_t | UNWIF_combin_00_04 [256] |
| static const uint8_t | UNWIF_combin_00_05 [256] |
| static const uint8_t | UNWIF_combin_00_06 [256] |
| static const uint8_t | UNWIF_combin_00_07 [256] |
| static const uint8_t | UNWIF_combin_00_08 [256] |
| static const uint8_t | UNWIF_combin_00_09 [256] |
| static const uint8_t | UNWIF_combin_00_0a [256] |
| static const uint8_t | UNWIF_combin_00_0b [256] |
| static const uint8_t | UNWIF_combin_00_0c [256] |
| static const uint8_t | UNWIF_combin_00_0d [256] |
| static const uint8_t | UNWIF_combin_00_0e [256] |
| static const uint8_t | UNWIF_combin_00_0f [256] |
| static const uint8_t | UNWIF_combin_00_10 [256] |
| static const uint8_t | UNWIF_combin_00_13 [256] |
| static const uint8_t | UNWIF_combin_00_17 [256] |
| static const uint8_t | UNWIF_combin_00_18 [256] |
| static const uint8_t | UNWIF_combin_00_19 [256] |
| static const uint8_t | UNWIF_combin_00_1a [256] |
| static const uint8_t | UNWIF_combin_00_1b [256] |
| static const uint8_t | UNWIF_combin_00_1c [256] |
| static const uint8_t | UNWIF_combin_00_1d [256] |
| static const uint8_t | UNWIF_combin_00_20 [256] |
| static const uint8_t | UNWIF_combin_00_2c [256] |
| static const uint8_t | UNWIF_combin_00_2d [256] |
| static const uint8_t | UNWIF_combin_00_30 [256] |
| static const uint8_t | UNWIF_combin_00_a6 [256] |
| static const uint8_t | UNWIF_combin_00_a8 [256] |
| static const uint8_t | UNWIF_combin_00_a9 [256] |
| static const uint8_t | UNWIF_combin_00_aa [256] |
| static const uint8_t | UNWIF_combin_00_ab [256] |
| static const uint8_t | UNWIF_combin_00_fb [256] |
| static const uint8_t | UNWIF_combin_00_fe [256] |
| static const uint8_t | UNWIF_combin_01_01 [256] |
| static const uint8_t | UNWIF_combin_01_02 [256] |
| static const uint8_t | UNWIF_combin_01_03 [256] |
| static const uint8_t | UNWIF_combin_01_0a [256] |
| static const uint8_t | UNWIF_combin_01_10 [256] |
| static const uint8_t | UNWIF_combin_01_11 [256] |
| static const uint8_t | UNWIF_combin_01_12 [256] |
| static const uint8_t | UNWIF_combin_01_13 [256] |
| static const uint8_t | UNWIF_combin_01_14 [256] |
| static const uint8_t | UNWIF_combin_01_15 [256] |
| static const uint8_t | UNWIF_combin_01_16 [256] |
| static const uint8_t | UNWIF_combin_01_17 [256] |
| static const uint8_t | UNWIF_combin_01_1a [256] |
| static const uint8_t | UNWIF_combin_01_1c [256] |
| static const uint8_t | UNWIF_combin_01_1d [256] |
| static const uint8_t | UNWIF_combin_01_6a [256] |
| static const uint8_t | UNWIF_combin_01_6b [256] |
| static const uint8_t | UNWIF_combin_01_bc [256] |
| static const uint8_t | UNWIF_combin_01_d1 [256] |
| static const uint8_t | UNWIF_combin_01_d2 [256] |
| static const uint8_t | UNWIF_combin_01_e0 [256] |
| static const uint8_t | UNWIF_combin_01_e8 [256] |
| static const uint8_t | UNWIF_combin_01_e9 [256] |
| static const uint8_t * | UNWIF_combin_00 [256] |
| static const uint8_t * | UNWIF_combin_01 [256] |
| static const uint8_t ** | UNWIF_combin [] |
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for timingsafe_bcmp.c:+Functions | |
| EXPORT int | _timingsafe_bcmp_chk (const void *b1, const void *b2, size_t n, const size_t destbos, const size_t srcbos) |
| EXPORT int _timingsafe_bcmp_chk | +( | +const void * | +b1, | +
| + | + | const void * | +b2, | +
| + | + | size_t | +n, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for snwprintf_s.c:+Macros | |
| #define | __STDC_WANT_LIB_EXT1__ 1 |
+Functions | |
| EXPORT int | snwprintf_s (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict fmt,...) |
| #define __STDC_WANT_LIB_EXT1__ 1 | +
| EXPORT int snwprintf_s | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsicmp_s.c:+Functions | |
| EXPORT errno_t | _wcsicmp_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, int *resultp, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcasestr_s.c:+Functions | |
| EXPORT errno_t | _strcasestr_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, char **substring, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Include dependency graph for safe_mem_constraint.c:+Functions | |
| EXPORT constraint_handler_t | set_mem_constraint_handler_s (constraint_handler_t handler) |
| The set_mem_constraint_handler_s function sets the runtime-constraint handler to be handler. More... | |
| EXPORT void | invoke_safe_mem_constraint_handler (const char *msg, void *ptr, errno_t error) |
| Invokes the currently set constraint handler or the default. More... | |
| void | handle_mem_bos_chk_warn (const char *restrict func, void *restrict dest, const rsize_t dmax, const size_t destbos) |
+Variables | |
| static constraint_handler_t | mem_handler = NULL |
| EXPORT constraint_handler_t set_mem_constraint_handler_s | +( | +constraint_handler_t | +handler | ) | ++ |
The set_mem_constraint_handler_s function sets the runtime-constraint handler to be handler.
+The runtime-constraint handler is the function to be called when a library function detects a runtime-constraint order:
| EXPORT void invoke_safe_mem_constraint_handler | +( | +const char * | +msg, | +
| + | + | void * | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
Invokes the currently set constraint handler or the default.
+Can be disabled via –disable-constraint-handler
| *msg | Pointer to the message describing the error. |
| *ptr | Pointer to associated data. Can be NULL. |
| error | The error code encountered. |
| void handle_mem_bos_chk_warn | +( | +const char *restrict | +func, | +
| + | + | void *restrict | +dest, | +
| + | + | const rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for bsearch_s.c:+Functions | |
| EXPORT void * | _bsearch_s_chk (const void *key, const void *base, rsize_t nmemb, rsize_t size, int(*compar)(const void *k, const void *y, void *context), void *context, const size_t basebos) |
| EXPORT void* _bsearch_s_chk | +( | +const void * | +key, | +
| + | + | const void * | +base, | +
| + | + | rsize_t | +nmemb, | +
| + | + | rsize_t | +size, | +
| + | + | int(*)(const void *k, const void *y, void *context) | +compar, | +
| + | + | void * | +context, | +
| + | + | const size_t | +basebos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wctomb_s.c:+Functions | |
| EXPORT errno_t | _wctomb_s_chk (int *restrict retvalp, char *restrict dest, rsize_t dmax, wchar_t wc, const size_t destbos) |
| EXPORT errno_t _wctomb_s_chk | +( | +int *restrict | +retvalp, | +
| + | + | char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | wchar_t | +wc, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcscoll_s.c:+Functions | |
| EXPORT errno_t | _wcscoll_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, int *resultp, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for tmpfile_s.c:+Functions | |
| EXPORT errno_t | tmpfile_s (FILE *restrict *restrict streamptr) |
The tmpfile_s function creates a temporary binary file that is different from any other existing file and that will automatically be removed when it is closed or at program termination. More... | |
| EXPORT errno_t tmpfile_s | +( | +FILE *restrict *restrict | +streamptr | ) | ++ |
The tmpfile_s function creates a temporary binary file that is different from any other existing file and that will automatically be removed when it is closed or at program termination.
If the program terminates abnormally, whether an open temporary file is removed is implementation-defined. The file is opened for update with "wb+" mode with the meaning that mode has in the fopen_s function (including the mode’s effect on exclusive access and file permissions).
| streamptr | pointer to a pointer that will be updated by this function call |
If the file was created successfully, then the pointer to FILE pointed to by streamptr will be set to the pointer to the object controlling the opened file. Otherwise, the pointer to FILE pointed to by streamptr will be set to a null pointer.
+| EOK | on success |
| ESNULLP | when streamptr is a NULL pointer |
| ESLEMAX | when more than TMP_MAX_S files were opened. |
| errno() | when tmpfile() failed, typically ENOENT or EACCES |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for freopen_s.c:+Functions | |
| EXPORT errno_t | freopen_s (FILE *restrict *restrict newstreamptr, const char *restrict filename, const char *restrict mode, FILE *restrict stream) |
The freopen_s function first, attempts to close the file associated with the stream, ignoring any errors. More... | |
| EXPORT errno_t freopen_s | +( | +FILE *restrict *restrict | +newstreamptr, | +
| + | + | const char *restrict | +filename, | +
| + | + | const char *restrict | +mode, | +
| + | + | FILE *restrict | +stream | +
| + | ) | ++ |
The freopen_s function first, attempts to close the file associated with the stream, ignoring any errors.
Then, if filename is not null, attempts to open the file specified by filename using mode as if by fopen, and associates that file with the file stream pointed to by stream. If filename is a null pointer, then the function attempts to reopen the file that is already associated with stream (it is implementation defined which mode changes are allowed in this case).
+| [out] | newstreamptr | pointer to a FILE stream that will be updated by this function call |
| [in] | filename | file name to associate the file stream to |
| [in] | mode | as in fopen |
| [in] | stream | the file stream to modify |
If the file was reopened successfully, then the pointer to the FILE pointed to by newstreamptr will be set to the pointer to the object controlling the opened file. Otherwise, the pointer to the FILE pointed to by newstreamptr will be set to a null pointer.
+| EOK | on success |
| ESNULLP | when any argument is a NULL pointer |
| > | 0 any other errno |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memchr_s.c:+Functions | |
| EXPORT errno_t | _memchr_s_chk (const void *restrict dest, rsize_t dmax, const int ch, void **result, const size_t destbos) |
| EXPORT errno_t _memchr_s_chk | +( | +const void *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const int | +ch, | +
| + | + | void ** | +result, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strlastchar_s.c:+Functions | |
| EXPORT errno_t | _strlastchar_s_chk (char *dest, rsize_t dmax, char c, char **lastp, const size_t destbos) |
| EXPORT errno_t _strlastchar_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | char | +c, | +
| + | + | char ** | +lastp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vwprintf_s.c:+Functions | |
| EXPORT int | vwprintf_s (const wchar_t *restrict fmt, va_list ap) |
| The vwprintf_s function prints formatted output to stdout as wide string. More... | |
| EXPORT int vwprintf_s | +( | +const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vwprintf_s function prints formatted output to stdout as wide string.
+| [in] | fmt | format-control wide string. |
| [in] | ap | optional arguments |
fmt shall not be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer (not yet) | -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | some other error. errno: EINVAL or EOVERFLOW |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vsnwprintf_s.c:+Macros | |
| #define | __STDC_WANT_LIB_EXT1__ 1 |
+Functions | |
| EXPORT int | _vsnwprintf_s_chk (wchar_t *restrict dest, rsize_t dmax, const size_t destbos, const wchar_t *restrict fmt, va_list ap) |
| #define __STDC_WANT_LIB_EXT1__ 1 | +
| EXPORT int _vsnwprintf_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for gmtime_s.c:+Functions | |
| EXPORT struct tm * | gmtime_s (const time_t *restrict timer, struct tm *restrict dest) |
The gmtime_s function converts the given time since epoch to a calendar time, expressed in Coordinated Universal Time (UTC) in the struct tm format. More... | |
| EXPORT struct tm* gmtime_s | +( | +const time_t *restrict | +timer, | +
| + | + | struct tm *restrict | +dest | +
| + | ) | ++ |
The gmtime_s function converts the given time since epoch to a calendar time, expressed in Coordinated Universal Time (UTC) in the struct tm format.
The result is copied into the user-provided tm struct.
+| [in] | timer | pointer to a epoch (long, seconds since 1970) |
| [out] | dest | pointer to a user-provided struct tm. |
POSIX requires that this function sets errno to EOVERFLOW if it fails because the argument is too large. POSIX defines a thread-safe alternative gmtime_r, which is similar to the C11 function gmtime_s, except that it does not check the validity of its input parameters.
+This function is available under windows with a different API, reversed argument order, and is not available with safeclib.
+|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strismixedcase_s.c:+Functions | |
| EXPORT bool | _strismixedcase_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT bool _strismixedcase_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for ignore_handler_s.c:+Functions | |
| EXPORT void | ignore_handler_s (const char *restrict msg, void *restrict ptr, errno_t error) |
| This function simply returns to the caller. More... | |
| EXPORT void ignore_handler_s | +( | +const char *restrict | +msg, | +
| + | + | void *restrict | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
This function simply returns to the caller.
+| [in] | msg | Pointer to the message describing the error |
| [in] | ptr | Pointer to aassociated data. Can be NULL. |
| [in] | error | The error code encountered. |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsupr_s.c:+Functions | |
| EXPORT errno_t | _wcsupr_s_chk (wchar_t *restrict src, rsize_t slen, const size_t srcbos) |
| EXPORT errno_t _wcsupr_s_chk | +( | +wchar_t *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsstr.c:+Functions | |
| wchar_t * | wcsstr (wchar_t *restrict dest, const wchar_t *restrict src) |
| The wcsstr() function locates the first occurrence of the wide substring pointed to by src which would be located in the wide string pointed to by dest. More... | |
| wchar_t* wcsstr | +( | +wchar_t *restrict | +dest, | +
| + | + | const wchar_t *restrict | +src | +
| + | ) | ++ |
The wcsstr() function locates the first occurrence of the wide substring pointed to by src which would be located in the wide string pointed to by dest.
+| [in] | dest | wide string to be searched for the substring |
| [in] | src | pointer to the wide sub string |
| pointer | to the found substring, or NULL |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_config.h"#include "safe_lib_errno.h"#include "safe_types.h"#include "safe_compile.h"#include <wchar.h>
Include dependency graph for safe_mem_lib.h:+Macros | |
| #define | EXTERN extern |
| #define | RSIZE_MAX_MEM16 ( RSIZE_MAX_MEM/2 ) |
| #define | RSIZE_MAX_MEM32 ( RSIZE_MAX_MEM/4 ) |
| #define | RSIZE_MAX_WMEM ( RSIZE_MAX_MEM/sizeof(wchar_t) ) |
| #define | memcpy_s(dest, dmax, src, slen) _memcpy_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| This function copies at most slen bytes from src to dest, up to dmax resp. More... | |
| #define | memmove_s(dest, dmax, src, slen) _memmove_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
The memmove_s function copies slen bytes from the region pointed to by src into the region pointed to by dest. More... | |
| #define | memset_s(dest, dmax, value, n) _memset_s_chk(dest,dmax,value,n,BOS(dest)) |
| Sets the first n bytes starting at dest to the specified value, but maximal dmax bytes. More... | |
| #define | memset16_s(dest, dmax, value, n) _memset16_s_chk(dest,dmax,value,n,BOS(dest)) |
| Sets the first n uint16_t values starting at dest to the specified value, but maximal dmax bytes. More... | |
| #define | memset32_s(dest, dmax, value, n) _memset32_s_chk(dest,dmax,value,n,BOS(dest)) |
| Sets n uint32_t values starting at dest to the specified value, but maximal dmax bytes. More... | |
| #define | memcmp_s(dest, dmax, src, slen, diff) _memcmp_s_chk(dest,dmax,src,slen,diff,BOS(dest),BOS(src)) |
Compares memory until they differ, and their difference sign (-1,0,1) is returned in diff. More... | |
| #define | memcmp16_s(dest, dlen, src, slen, diff) _memcmp16_s_chk(dest,dlen,src,slen,diff,BOS(dest),BOS(src)) |
| Compares memory in uint16_t slices until they differ, and their difference is returned in diff. More... | |
| #define | memcmp32_s(dest, dlen, src, slen, diff) _memcmp32_s_chk(dest,dlen,src,slen,diff,BOS(dest),BOS(src)) |
| Compares memory in uint32_t slices until they differ, and their difference is returned in diff. More... | |
| #define | memcpy16_s(dest, dmax, src, slen) _memcpy16_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| This function copies at most slen uint16_t's from src to dest, up to dmax bytes. More... | |
| #define | memcpy32_s(dest, dmax, src, slen) _memcpy32_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| This function copies at most slen uint32_t's from src to dest, up to dmax. More... | |
| #define | memmove16_s(dest, dmax, src, slen) _memmove16_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| The memmove16_s function copies slen uint16_t from the region pointed to by src into the region pointed to by dest. More... | |
| #define | memmove32_s(dest, dmax, src, slen) _memmove32_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| The memmove32_s function copies slen uint32_t's from the region pointed to by src into the region pointed to by dest. More... | |
| #define | memzero_s(dest, len) _memzero_s_chk(dest,len,BOS(dest)) |
| Zeros len bytes starting at dest. More... | |
| #define | memzero16_s(dest, len) _memzero16_s_chk(dest,len,BOS(dest)) |
| Zeros len uint16_t's starting at dest. More... | |
| #define | memzero32_s(dest, len) _memzero32_s_chk(dest,len,BOS(dest)) |
| Zeros len uint32_t's starting at dest. More... | |
| #define | memchr_s(dest, dmax, ch, result) _memchr_s_chk(dest,dmax,ch,result,BOS(dest)) |
Finds the first occurrence of ch (after conversion to unsigned char as if by (unsigned char)ch) in the null-terminated buffer pointed to by dest (each character interpreted as unsigned char). More... | |
| #define | memrchr_s(dest, dmax, ch, result) _memrchr_s_chk(dest,dmax,ch,result,BOS(dest)) |
| Finds the last occurrence of ch (after conversion to char as if by (char)ch) in the null-terminated byte string pointed to by dest (each character interpreted as unsigned char). More... | |
| #define | timingsafe_bcmp(b1, b2, n) _timingsafe_bcmp_chk(b1,b2,n,BOS(b1),BOS(b2)) |
| Compare all memory bytes. More... | |
| #define | timingsafe_memcmp(b1, b2, len) _timingsafe_memcmp_chk(b1,b2,len,BOS(b1),BOS(b2)) |
| Compare all memory bytes. More... | |
| #define | memccpy_s(dest, dmax, src, c, n) _memccpy_s_chk(dest,dmax,src,c,n,BOS(dest),BOS(src)) |
memccpy_s copies no more than n bytes from memory area src to memory area dest, stopping when the character c is found. More... | |
| #define | wmemcpy_s(dest, dlen, src, count) _wmemcpy_s_chk(dest,dlen,src,count,BOS(dest),BOS(src)) |
| This function copies at most count wchar_t's from src to dest, up to dlen. More... | |
| #define | wmemmove_s(dest, dlen, src, count) _wmemmove_s_chk(dest,dlen,src,count,BOS(dest),BOS(src)) |
| The wmemmove_s function copies count wchar_t's from the region pointed to by src into the region pointed to by dest. More... | |
| #define | wmemcmp_s(dest, dlen, src, slen, diff) _wmemcmp_s_chk(dest,dlen,src,slen,diff,BOS(dest),BOS(src)) |
| Compares buffers of wide chars until they differ, and return 0 if the same or -1 or 1 in diff. More... | |
+Functions | |
| EXTERN constraint_handler_t | set_mem_constraint_handler_s (constraint_handler_t handler) |
| The set_mem_constraint_handler_s function sets the runtime-constraint handler to be handler. More... | |
| EXTERN errno_t | _memcpy_s_chk (void *restrict dest, rsize_t dmax, const void *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) BOS_CHK_BUTZERO(dest |
| EXTERN errno_t slen | BOS_OVR2_BUTZERO (src, slen) BOS_ATTR(_BOS_KNOWN(dest) &&_BOS_KNOWN(src) &&((dest > src &&(char *) dest<(char *) src+slen)||(src > dest &&(char *) src<(char *) dest+dmax)) |
| EXTERN errno_t | _memmove_s_chk (void *dest, rsize_t dmax, const void *src, rsize_t slen, const size_t destbos, const size_t srcbos) BOS_CHK_BUTZERO(dest |
| EXTERN errno_t slen | BOS_OVR2_BUTZERO (src, slen) VAL_OVR2_BUTZERO(slen |
| EXTERN errno_t | _memset_s_chk (void *dest, rsize_t dmax, int value, rsize_t n, const size_t destbos) BOS_ATTR(n &&(_BOS_OVR(dest |
| EXTERN errno_t n n n overflow dest dmax | VAL_OVR2 (value, 255) |
| EXTERN errno_t | _memset16_s_chk (uint16_t *dest, rsize_t dmax, uint16_t value, rsize_t n, const size_t destbos) BOS_ATTR(n &&(_BOS_OVR(dest |
| EXTERN errno_t | _memset32_s_chk (uint32_t *dest, rsize_t dmax, uint32_t value, rsize_t n, const size_t destbos) BOS_ATTR(n &&(_BOS_OVR(dest |
| EXTERN errno_t | _memcmp_s_chk (const void *dest, rsize_t dmax, const void *src, rsize_t slen, int *diff, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_OVR2(src |
| EXTERN errno_t slen | BOS_NULL (diff) VAL_OVR2_BUTZERO(slen |
| EXTERN errno_t | _memcmp16_s_chk (const uint16_t *dest, rsize_t dlen, const uint16_t *src, rsize_t slen, int *diff, const size_t destbos, const size_t srcbos) VAL_OVR2_BUTZERO(slen |
| EXTERN errno_t | _memcmp32_s_chk (const uint32_t *dest, rsize_t dlen, const uint32_t *src, rsize_t slen, int *diff, const size_t destbos, const size_t srcbos) VAL_OVR2_BUTZERO(slen |
| EXTERN errno_t | _memcpy16_s_chk (uint16_t *dest, rsize_t dmax, const uint16_t *src, rsize_t slen, const size_t destbos, const size_t srcbos) VAL_OVR2_BUTZERO(slen |
| EXTERN errno_t | _memcpy32_s_chk (uint32_t *dest, rsize_t dmax, const uint32_t *src, rsize_t slen, const size_t destbos, const size_t srcbos) VAL_OVR2_BUTZERO(slen |
| EXTERN errno_t | _memmove16_s_chk (uint16_t *dest, rsize_t dmax, const uint16_t *src, rsize_t slen, const size_t destbos, const size_t srcbos) VAL_OVR2_BUTZERO(slen |
| EXTERN errno_t | _memmove32_s_chk (uint32_t *dest, rsize_t dmax, const uint32_t *src, rsize_t slen, const size_t destbos, const size_t srcbos) VAL_OVR2_BUTZERO(slen |
| EXTERN errno_t | _memzero_s_chk (void *dest, rsize_t dmax, const size_t destbos) BOS_CHK(dest) |
| EXTERN errno_t | _memzero16_s_chk (uint16_t *dest, rsize_t len, const size_t destbos) BOS_CHK2(dest |
| EXTERN errno_t | _memzero32_s_chk (uint32_t *dest, rsize_t len, const size_t destbos) BOS_CHK2(dest |
| EXTERN errno_t | _memchr_s_chk (const void *restrict dest, rsize_t dmax, const int ch, void **result, const size_t destbos) BOS_NULL(result) |
| EXTERN errno_t | _memrchr_s_chk (const void *restrict dest, rsize_t dmax, const int ch, void **result, const size_t destbos) BOS_CHK(dest) VAL_OVR2(ch |
| EXTERN errno_t | BOS_NULL (result) |
| EXTERN int | _timingsafe_bcmp_chk (const void *b1, const void *b2, size_t n, const size_t destbos, const size_t srcbos) BOS_OVR2(b1 |
| EXTERN int n | BOS_OVR2 (b2, n) |
| EXTERN int | _timingsafe_memcmp_chk (const void *b1, const void *b2, size_t len, const size_t destbos, const size_t srcbos) BOS_OVR2(b1 |
| EXTERN int len | BOS_OVR2 (b2, len) |
| EXTERN errno_t | _memccpy_s_chk (void *dest, rsize_t dmax, const void *src, int c, rsize_t n, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_OVR2(src |
| EXTERN errno_t n | VAL_OVR2 (c, 255) VAL_OVR2_BUTZERO(n |
| EXTERN errno_t | _wmemcpy_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, const size_t destbos, const size_t srcbos) BOSW_CHK_BUTZERO(dest |
| EXTERN errno_t smax | BOSW_OVR2_BUTZERO (src, smax) |
| EXTERN errno_t | _wmemmove_s_chk (wchar_t *dest, rsize_t dmax, const wchar_t *src, rsize_t smax, const size_t destbos, const size_t srcbos) BOSW_CHK_BUTZERO(dest |
| EXTERN errno_t | _wmemcmp_s_chk (const wchar_t *dest, rsize_t dmax, const wchar_t *src, rsize_t slen, int *diff, const size_t destbos, const size_t srcbos) BOSW_CHK(dest) BOSW_CHK2(src |
+Variables | |
| EXTERN errno_t slen dest overlaps with | src |
| EXTERN errno_t slen | dmax |
| EXTERN errno_t | dlen |
| #define EXTERN extern | +
| #define RSIZE_MAX_MEM16 ( RSIZE_MAX_MEM/2 ) | +
| #define RSIZE_MAX_MEM32 ( RSIZE_MAX_MEM/4 ) | +
| #define RSIZE_MAX_WMEM ( RSIZE_MAX_MEM/sizeof(wchar_t) ) | +
| #define memcpy_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_memcpy_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
This function copies at most slen bytes from src to dest, up to dmax resp.
+sizeof(dest). If slen is zero, the function does nothing.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | dmax | maximum length of the resulting dest, in bytes |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | slen | maximum number bytes of src that can be copied |
| EOK | when operation is successful or slen = 0 |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOSPC | when dmax < slen |
| ESOVRLP | when src memory overlaps dst |
| #define memmove_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_memmove_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
The memmove_s function copies slen bytes from the region pointed to by src into the region pointed to by dest.
If slen is zero, the function does nothing.
+This copying takes place as if the slen bytes from the region pointed to by src are first copied into a temporary array of slen bytes that does not overlap the region pointed to by dest or src, and then the slen bytes from the temporary array are copied into the object region to by dest.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | dmax | maximum length of the resulting dest, in bytes |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | slen | maximum number bytes of src that can be copied |
| EOK | when operation is successful or slen = 0 |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOSPC | when dmax < slen |
| #define memset_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | value, | +
| + | + | + | n | +
| + | ) | +_memset_s_chk(dest,dmax,value,n,BOS(dest)) | +
Sets the first n bytes starting at dest to the specified value, but maximal dmax bytes.
+| [out] | dest | pointer to memory that will be set to the value |
| [in] | dmax | maximum number of bytes to be written |
| [in] | value | byte value to be written |
| [in] | n | number of bytes to be set |
| EOK | when operation is successful or n = 0 |
| ESNULLP | when dest is NULL pointer |
| ESLEMAX | when dmax/n > RSIZE_MAX_MEM or value > 255 |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESNOSPC | when dmax < n |
| #define memset16_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | value, | +
| + | + | + | n | +
| + | ) | +_memset16_s_chk(dest,dmax,value,n,BOS(dest)) | +
Sets the first n uint16_t values starting at dest to the specified value, but maximal dmax bytes.
+| [out] | dest | pointer to memory that will be set to the value |
| [in] | dmax | maximum number of bytes to be written |
| [in] | value | byte value to be written |
| [in] | n | number of short (2-byte) words to be set |
| EOK | when operation is successful or n = 0 |
| ESNULLP | when dest is NULL POINTER |
| ESLEMAX | when dmax > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESLEMAX | when n > RSIZE_MAX_MEM16 |
| ESNOSPC | when 2*n > dmax |
| #define memset32_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | value, | +
| + | + | + | n | +
| + | ) | +_memset32_s_chk(dest,dmax,value,n,BOS(dest)) | +
Sets n uint32_t values starting at dest to the specified value, but maximal dmax bytes.
+| [out] | dest | pointer to memory that will be set to the value |
| [in] | dmax | maximum number of bytes to be written |
| [in] | value | byte value to be written |
| [in] | n | number of 4-byte words to be set |
| EOK | when operation is successful or n = 0 |
| ESNULLP | when dest is NULL POINTER |
| ESLEMAX | when dmax > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESLEMAX | when n > RSIZE_MAX_MEM32 |
| ESNOSPC | when 4*n > dmax |
| #define memcmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | diff | +
| + | ) | +_memcmp_s_chk(dest,dmax,src,slen,diff,BOS(dest),BOS(src)) | +
Compares memory until they differ, and their difference sign (-1,0,1) is returned in diff.
If the block of memory is the same, *diff=0.
| dest | pointer to memory to compare against |
| src | pointer to the source memory to compare with dest |
| dmax | maximum length of dest, in bytes |
| slen | length of the source memory block |
| *diff | pointer to the diff which is an integer greater than, equal to or less than zero according to whether the object pointed to by dest is greater than, equal to or less than the object pointed to by src. |
| EOK | when operation is successful |
| ESNULLP | when dst/src is NULL POINTER |
| ESZEROL | when dmax/slen = ZERO |
| ESLEMAX | when dmax/slen > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax/slen != size of dest/src and –enable-error-dmax |
| ESNOSPC | when dmax < slen |
| #define memcmp16_s | +( | ++ | dest, | +
| + | + | + | dlen, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | diff | +
| + | ) | +_memcmp16_s_chk(dest,dlen,src,slen,diff,BOS(dest),BOS(src)) | +
Compares memory in uint16_t slices until they differ, and their difference is returned in diff.
+If the block of memory is the same, diff=0.
+| dest | pointer to memory to compare against |
| dlen | maximum length of dest, in uint16_t's |
| src | pointer to the source memory to compare with dest |
| slen | number of uint16_t's from source to be compared |
| *diff | pointer to the diff which is an integer greater than, equal to or less than zero according to whether the object pointed to by dest is greater than, equal to or less than the object pointed to by src. |
| EOK | when operation is successful |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dlen/slen = ZERO |
| ESLEMAX | when dlen/slen > RSIZE_MAX_MEM16 |
| EOVERFLOW | when 2*dlen/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when 2*dlen/slen != sizeof(dest/src) and –enable-error-dmax |
| ESNOSPC | when dlen < slen |
| #define memcmp32_s | +( | ++ | dest, | +
| + | + | + | dlen, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | diff | +
| + | ) | +_memcmp32_s_chk(dest,dlen,src,slen,diff,BOS(dest),BOS(src)) | +
Compares memory in uint32_t slices until they differ, and their difference is returned in diff.
+If the whole block of memory is the same, diff=0.
+| dest | pointer to memory to compare against |
| dlen | maximum length of dest, in uint32_t's |
| src | pointer to the source memory to compare with dest |
| slen | number of uint32_t's from source to be compared |
| *diff | pointer to the diff which is an integer greater than, equal to or less than zero according to whether the object pointed to by dest is greater than, equal to or less than the object pointed to by src. |
| EOK | when operation is successful |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dlen/slen = ZERO |
| ESLEMAX | when dlen/slen > RSIZE_MAX_MEM32 or > sizeof(dest/src)/4 |
| EOVERFLOW | when 4*dlen/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when 4*dlen/slen != sizeof(dest/src) and –enable-error-dmax |
| ESNOSPC | when dlen < slen |
| #define memcpy16_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_memcpy16_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
This function copies at most slen uint16_t's from src to dest, up to dmax bytes.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | dmax | maximum length of the resulting dest, in bytes |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | slen | number of uint16_t's to be copied |
| EOK | when operation is successful or slen = 0 |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dmax = ZERO |
| ESLEMAX | when dmax > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESLEMAX | when slen > RSIZE_MAX_MEM16 |
| EOVERFLOW | when 2*slen > size of src (optionally, when the compiler knows the object_size statically) |
| ESNOSPC | when 2*slen > dmax |
| ESOVRLP | when src memory overlaps dest |
| #define memcpy32_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_memcpy32_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
This function copies at most slen uint32_t's from src to dest, up to dmax.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | dmax | maximum length of the resulting dest, in bytes |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | slen | number of uint32_t's to be copied |
| EOK | when operation is successful or slen = 0 |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dmax = ZERO |
| ESLEMAX | when dmax > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESLEMAX | when slen > RSIZE_MAX_MEM32 |
| EOVERFLOW | when 4*slen > size of src (optionally, when the compiler knows the object_size statically) |
| ESNOSPC | when 4*slen > dmax |
| ESOVRLP | when src memory overlaps dest |
| #define memmove16_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_memmove16_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
The memmove16_s function copies slen uint16_t from the region pointed to by src into the region pointed to by dest.
+This copying takes place as if the slen uint16_t from the region pointed to by src are first copied into a temporary array of slen uint16_t that does not overlap the regions pointed to by dest or src, and then the slen uint16_t from the temporary array are copied into the region pointed to by dest.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | dmax | maximum length of the resulting dest, in bytes |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | slen | number of uint16_t's to be copied |
| EOK | when operation is successful or slen = 0 |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dmax = ZERO |
| ESLEMAX | when dmax > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESLEMAX | when slen > RSIZE_MAX_MEM16 |
| EOVERFLOW | when 2*slen > size of src (optionally, when the compiler knows the object_size statically) |
| ESNOSPC | when 2*slen > dmax |
| #define memmove32_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_memmove32_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
The memmove32_s function copies slen uint32_t's from the region pointed to by src into the region pointed to by dest.
+This copying takes place as if the slen uint32_t's from the region pointed to by src are first copied into a temporary array of slen uint32_t's that does not overlap the regions pointed to by dest or src, and then the slen uint32_t's from the temporary array are copied into the region pointed to by dest.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | dmax | maximum length of the resulting dest, in bytes |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | slen | number of uint32_t's to be copied |
| EOK | when operation is successful or slen = 0 |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dmax = ZERO |
| ESLEMAX | when dmax > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESLEMAX | when slen > RSIZE_MAX_MEM32 |
| EOVERFLOW | when 4*slen > size of src (optionally, when the compiler knows the object_size statically) |
| ESNOSPC | when 4*slen > dmax |
| #define memzero_s | +( | ++ | dest, | +
| + | + | + | len | +
| + | ) | +_memzero_s_chk(dest,len,BOS(dest)) | +
Zeros len bytes starting at dest.
+| [out] | dest | pointer to memory to be zeroed. |
| [in] | len | number of bytes to be zeroed |
| EOK | when operation is successful |
| ESNULLP | when dest is NULL POINTER |
| ESZEROL | when len = ZERO |
| ESLEMAX | when len > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when len != size of dest and –enable-error-dmax |
| #define memzero16_s | +( | ++ | dest, | +
| + | + | + | len | +
| + | ) | +_memzero16_s_chk(dest,len,BOS(dest)) | +
Zeros len uint16_t's starting at dest.
+| [out] | dest | pointer to memory to be zeroed. |
| [in] | len | number of uint16_t's to be zeroed |
| EOK | when operation is successful |
| ESNULLP | when dest is NULL POINTER |
| ESZEROL | when len = ZERO |
| ESLEMAX | when len > RSIZE_MAX_MEM16 |
| EOVERFLOW | when 2*dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when len != sizeof(dest)/2 and –enable-error-dmax |
| #define memzero32_s | +( | ++ | dest, | +
| + | + | + | len | +
| + | ) | +_memzero32_s_chk(dest,len,BOS(dest)) | +
Zeros len uint32_t's starting at dest.
+| [out] | dest | pointer to memory to be zeroed. |
| [in] | len | number of uint32_t's to be zeroed |
| EOK | when operation is successful |
| ESNULLP | when dest is NULL POINTER |
| ESZEROL | when len = ZERO |
| ESLEMAX | when len > RSIZE_MAX_MEM32 |
| EOVERFLOW | when 2*dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when len != sizeof(dest)/4 and –enable-error-dmax |
| #define memchr_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | ch, | +
| + | + | + | result | +
| + | ) | +_memchr_s_chk(dest,dmax,ch,result,BOS(dest)) | +
Finds the first occurrence of ch (after conversion to unsigned char as if by (unsigned char)ch) in the null-terminated buffer pointed to by dest (each character interpreted as unsigned char).
| [in] | dest | pointer to buffer to compare against |
| [in] | dmax | length of dest to search in |
| [in] | ch | character to search for |
| [out] | result | pointer to result in dest |
| EOK | when successfully character found. |
| ESNULLP | when dest/result is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_MEM or > sizeof(dest) |
| ESLEMAX | when ch > 255 |
| ESNOTFND | when ch not found in dest |
| #define memrchr_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | ch, | +
| + | + | + | result | +
| + | ) | +_memrchr_s_chk(dest,dmax,ch,result,BOS(dest)) | +
Finds the last occurrence of ch (after conversion to char as if by (char)ch) in the null-terminated byte string pointed to by dest (each character interpreted as unsigned char).
+The terminating null character is considered to be a part of the string and can be found when searching for '\0'.
+| [in] | dest | pointer to string buffer to compare against |
| [in] | dmax | restricted maximum length of dest |
| [in] | ch | character to search for |
| [out] | result | pointer to char* in dest |
| EOK | when successfully character found. |
| ESNULLP | when dest/result is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESLEMAX | when ch > 255 |
| ESNOTFND | when ch not found in dest |
| #define timingsafe_bcmp | +( | ++ | b1, | +
| + | + | + | b2, | +
| + | + | + | n | +
| + | ) | +_timingsafe_bcmp_chk(b1,b2,n,BOS(b1),BOS(b2)) | +
Compare all memory bytes.
+Return 0 or not zero.
+The running time is independent of the byte sequences compared, making them safe to use for comparing secret values such as cryptographic MACs. In contrast, bcmp(3) and memcmp(3) may short-circuit after finding the first differing byte.
+| b1 | pointer to memory to compare against |
| b2 | pointer to the source memory to compare with b1 |
| n | number of bytes to compare in both buffers |
| 0 | if the buffers are equal, or not zero if they are not equal. |
| -ESLEMAX | if n > RSIZE_MAX_MEM or > sizeof(b1) or > sizeof(b2) |
| #define timingsafe_memcmp | +( | ++ | b1, | +
| + | + | + | b2, | +
| + | + | + | len | +
| + | ) | +_timingsafe_memcmp_chk(b1,b2,len,BOS(b1),BOS(b2)) | +
Compare all memory bytes.
+Return their difference sign (-1,0,1).
The running time is independent of the byte sequences compared, making them safe to use for comparing secret values such as cryptographic MACs. In contrast, bcmp(3) and memcmp(3) may short-circuit after finding the first differing byte.
+| b1 | pointer to memory to compare against |
| b2 | pointer to the source memory to compare with b1 |
| len | number of bytes to compare in both buffers |
| -1,0,or | 1 |
| -ESLEMAX | if len > RSIZE_MAX_MEM or > sizeof(b1) or > sizeof(b2) |
| #define memccpy_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | c, | +
| + | + | + | n | +
| + | ) | +_memccpy_s_chk(dest,dmax,src,c,n,BOS(dest),BOS(src)) | +
memccpy_s copies no more than n bytes from memory area src to memory area dest, stopping when the character c is found.
Throws error if the memory areas overlap. With SAFECLIB_STR_NULL_SLACK defined the rest (max. n bytes, not dmax) is cleared with NULL bytes.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | dmax | maximum length of the resulting dest, in bytes |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | c | character to be found |
| [in] | n | maximum number bytes of src that can be copied |
memccpy(). | EOK | when operation is successful or n = 0 |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dmax = ZERO. |
| ESLEMAX | when dmax/n > RSIZE_MAX_MEM |
| EOVERFLOW | when dmax/n > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESNOSPC | when n > dmax |
| ESOVRLP | when src memory overlaps dst |
| #define wmemcpy_s | +( | ++ | dest, | +
| + | + | + | dlen, | +
| + | + | + | src, | +
| + | + | + | count | +
| + | ) | +_wmemcpy_s_chk(dest,dlen,src,count,BOS(dest),BOS(src)) | +
This function copies at most count wchar_t's from src to dest, up to dlen.
+If count is zero, the function does nothing.
+| [out] | dest | pointer to the wide string that will be replaced by src. |
| [in] | dlen | maximum length of the resulting dest, in wchar_t |
| [in] | src | pointer to the wide string that will be copied to dest |
| [in] | count | number of wide characters to copy |
| EOK | when operation is successful |
| ESNULLP | when dest or src is a NULL POINTER |
| ESZEROL | when dlen = ZERO |
| ESLEMAX | when dlen/count > RSIZE_MAX_WMEM |
| EOVERFLOW | when dlen/count > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dlen != sizeof(dest) and –enable-error-dmax |
| ESNOSPC | when dlen < count |
| ESOVRLP | when src memory overlaps dst |
| #define wmemmove_s | +( | ++ | dest, | +
| + | + | + | dlen, | +
| + | + | + | src, | +
| + | + | + | count | +
| + | ) | +_wmemmove_s_chk(dest,dlen,src,count,BOS(dest),BOS(src)) | +
The wmemmove_s function copies count wchar_t's from the region pointed to by src into the region pointed to by dest.
+If count is zero, the function does nothing.
+This copying takes place as if the count wchar_t's from the region pointed to by src are first copied into a temporary array of count wchar_t's that does not overlap the regions pointed to by dest or src, and then the count wchar_t's from the temporary array are copied into the region pointed to by dest.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | dlen | maximum length of the resulting dest, in wchar_t |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | count | maximum number of wide characters to copy |
| EOK | when operation is successful |
| ESNULLP | when dest or src is a NULL POINTER |
| ESZEROL | when dlen = ZERO |
| ESLEMAX | when dlen/count > RSIZE_MAX_WMEM |
| EOVERFLOW | when dlen/count > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dlen != sizeof(dest) and –enable-error-dmax |
| ESNOSPC | when dlen < count |
| #define wmemcmp_s | +( | ++ | dest, | +
| + | + | + | dlen, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | diff | +
| + | ) | +_wmemcmp_s_chk(dest,dlen,src,slen,diff,BOS(dest),BOS(src)) | +
Compares buffers of wide chars until they differ, and return 0 if the same or -1 or 1 in diff.
+| dest | pointer to wchar_t buffer to compare against |
| dlen | maximum length of dest, in number of wchar_t |
| src | pointer to the source wchar_t buffer to compare with dest |
| slen | length of the source memory block |
| *diff | pointer to the diff which is -1, 0 or 1 according to whether the object pointed to by dest is greater than, equal to or less than the object pointed to by src. Note that musl returns the diff here. |
| EOK | when operation is successful |
| ESNULLP | when dest/src is NULL POINTER |
| ESZEROL | when dlen/slen = ZERO |
| ESLEMAX | when dlen/slen > RSIZE_MAX_WMEM |
| EOVERFLOW | when dlen/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dlen != size of dest and –enable-error-dmax |
| ESNOSPC | when slen > dlen |
| EXTERN constraint_handler_t set_mem_constraint_handler_s | +( | +constraint_handler_t | +handler | ) | ++ |
The set_mem_constraint_handler_s function sets the runtime-constraint handler to be handler.
+The runtime-constraint handler is the function to be called when a library function detects a runtime-constraint order:
| EXTERN errno_t _memcpy_s_chk | +( | +void *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const void *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memmove_s_chk | +( | +void * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const void * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memset_s_chk | +( | +void * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | int | +value, | +
| + | + | rsize_t | +n, | +
| + | + | const size_t | +destbos | +
| + | ) | +&& | +
| EXTERN errno_t n n n overflow dest dmax VAL_OVR2 | +( | +value | +, | +
| + | + | 255 | ++ |
| + | ) | ++ |
| EXTERN errno_t _memset16_s_chk | +( | +uint16_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | uint16_t | +value, | +
| + | + | rsize_t | +n, | +
| + | + | const size_t | +destbos | +
| + | ) | +&& | +
| EXTERN errno_t _memset32_s_chk | +( | +uint32_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | uint32_t | +value, | +
| + | + | rsize_t | +n, | +
| + | + | const size_t | +destbos | +
| + | ) | +&& | +
| EXTERN errno_t _memcmp_s_chk | +( | +const void * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const void * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | int * | +diff, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memcmp16_s_chk | +( | +const uint16_t * | +dest, | +
| + | + | rsize_t | +dlen, | +
| + | + | const uint16_t * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | int * | +diff, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memcmp32_s_chk | +( | +const uint32_t * | +dest, | +
| + | + | rsize_t | +dlen, | +
| + | + | const uint32_t * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | int * | +diff, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memcpy16_s_chk | +( | +uint16_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const uint16_t * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memcpy32_s_chk | +( | +uint32_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const uint32_t * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memmove16_s_chk | +( | +uint16_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const uint16_t * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memmove32_s_chk | +( | +uint32_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const uint32_t * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memzero_s_chk | +( | +void * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _memzero16_s_chk | +( | +uint16_t * | +dest, | +
| + | + | rsize_t | +len, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _memzero32_s_chk | +( | +uint32_t * | +dest, | +
| + | + | rsize_t | +len, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _memchr_s_chk | +( | +const void *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const int | +ch, | +
| + | + | void ** | +result, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _memrchr_s_chk | +( | +const void *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const int | +ch, | +
| + | + | void ** | +result, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t BOS_NULL | +( | +result | +) | ++ |
| EXTERN int _timingsafe_bcmp_chk | +( | +const void * | +b1, | +
| + | + | const void * | +b2, | +
| + | + | size_t | +n, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN int n BOS_OVR2 | +( | +b2 | +, | +
| + | + | n | ++ |
| + | ) | ++ |
| EXTERN int _timingsafe_memcmp_chk | +( | +const void * | +b1, | +
| + | + | const void * | +b2, | +
| + | + | size_t | +len, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _memccpy_s_chk | +( | +void * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const void * | +src, | +
| + | + | int | +c, | +
| + | + | rsize_t | +n, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t n VAL_OVR2 | +( | +c | +, | +
| + | + | 255 | ++ |
| + | ) | ++ |
| EXTERN errno_t _wmemcpy_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wmemmove_s_chk | +( | +wchar_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t * | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wmemcmp_s_chk | +( | +const wchar_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | int * | +diff, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t n dmax | +
| EXTERN errno_t dlen | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for abort_handler_s.c:+Functions | |
| EXPORT void | abort_handler_s (const char *restrict msg, void *restrict ptr, errno_t error) |
| This function writes a message on the standard error stream in an implementation-defined format. More... | |
| EXPORT void abort_handler_s | +( | +const char *restrict | +msg, | +
| + | + | void *restrict | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
This function writes a message on the standard error stream in an implementation-defined format.
+The message shall include the string pointed to by msg. The abort_handler_s function then calls the abort function.
+| [in] | msg | Pointer to the message describing the error |
| [in] | ptr | Pointer to aassociated data. Can be NULL. |
| [in] | error | The error code encountered. |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for snprintf_s.c:+Functions | |
| EXPORT int | snprintf_s (char *restrict dest, rsize_t dmax, const char *restrict fmt,...) |
| EXPORT int snprintf_s | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memmove_s.c:+Functions | |
| EXPORT errno_t | _memmove_s_chk (void *dest, rsize_t dmax, const void *src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcslwr_s.c:+Functions | |
| EXTERN wint_t | towlower (wint_t wc) |
| EXPORT errno_t | _wcslwr_s_chk (wchar_t *restrict src, rsize_t slen, const size_t srcbos) |
| EXTERN wint_t towlower | +( | +wint_t | +wc | ) | ++ |
| EXPORT errno_t _wcslwr_s_chk | +( | +wchar_t *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strzero_s.c:+Functions | |
| EXPORT errno_t | _strzero_s_chk (char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT errno_t _strzero_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vwscanf_s.c:+Functions | |
| EXPORT int | vwscanf_s (const wchar_t *restrict fmt, va_list ap) |
The vwscanf_s function reads a formatted wide string from stdin. More... | |
| EXPORT int vwscanf_s | +( | +const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vwscanf_s function reads a formatted wide string from stdin.
Reaching the end of the stdin buffer is equivalent to reaching the end-of-file condition for vwscanf.
| [in] | fmt | format-control wide string. |
| [out] | ap | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for swscanf_s.c:+Functions | |
| EXPORT int | swscanf_s (const wchar_t *restrict src, const wchar_t *restrict fmt,...) |
| The swscanf_s function reads a formatted wide string. More... | |
| EXPORT int swscanf_s | +( | +const wchar_t *restrict | +src, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The swscanf_s function reads a formatted wide string.
+Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf.
| [in] | src | pointer to a null-terminated wide string to read from |
| [in] | fmt | format-control wide string. |
| [out] | ... | arguments to write to |
src nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memmove16_s.c:+Functions | |
| EXPORT errno_t | _memmove16_s_chk (uint16_t *dest, rsize_t dmax, const uint16_t *src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for towctrans.c:+Macros | |
| #define | CASEMAP(u1, u2, l) { (u1), (l)-(u1), (u2)-(u1)+1 } |
| #define | CASELACE(u1, u2) CASEMAP((u1),(u2),(u1)+1) |
+Functions | |
| EXPORT uint32_t | _towcase (uint32_t wc, int lower) |
| EXPORT uint32_t | _towupper (uint32_t wc) |
| EXPORT uint32_t | towupper (uint32_t wc) |
| EXPORT uint32_t | towlower (uint32_t wc) |
+Variables | |
| struct { | |
| unsigned short upper | |
| signed char lower | |
| unsigned char len | |
| } | casemaps [] |
| struct { | |
| unsigned int upper | |
| int lower | |
| unsigned short len | |
| } | casemapsl [] |
| static const unsigned short | pairs [][2] |
| #define CASEMAP | +( | ++ | u1, | +
| + | + | + | u2, | +
| + | + | + | l | +
| + | ) | +{ (u1), (l)-(u1), (u2)-(u1)+1 } | +
| #define CASELACE | +( | ++ | u1, | +
| + | + | + | u2 | +
| + | ) | +CASEMAP((u1),(u2),(u1)+1) | +
| EXPORT uint32_t _towcase | +( | +uint32_t | +wc, | +
| + | + | int | +lower | +
| + | ) | ++ |
| EXPORT uint32_t _towupper | +( | +uint32_t | +wc | ) | ++ |
| EXPORT uint32_t towupper | +( | +uint32_t | +wc | ) | ++ |
| EXPORT uint32_t towlower | +( | +uint32_t | +wc | ) | ++ |
| unsigned int upper | +
| int lower | +
| unsigned short len | +
| const { ... } casemaps[] | +
| const { ... } casemapsl[] | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsnatcmp_s.c:+Macros | |
| #define | iswdigit(ch) isdigit((int)(ch)) |
| #define | iswspace(ch) isspace((int)(ch)) |
+Functions | |
| static int | compare_right (wchar_t const *a, wchar_t const *b) |
| static int | compare_left (wchar_t const *a, wchar_t const *b) |
| EXPORT errno_t | _wcsnatcmp_s_chk (const wchar_t *dest, rsize_t dmax, const wchar_t *src, rsize_t smax, const int fold_case, int *resultp, const size_t destbos, const size_t srcbos) |
| #define iswdigit | +( | ++ | ch | ) | +isdigit((int)(ch)) | +
| #define iswspace | +( | ++ | ch | ) | +isspace((int)(ch)) | +
+
|
+ +static | +
+
|
+ +static | +
| EXPORT errno_t _wcsnatcmp_s_chk | +( | +const wchar_t * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t * | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | const int | +fold_case, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strisalphanumeric_s.c:+Functions | |
| bool | _strisalphanumeric_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| bool _strisalphanumeric_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strisascii_s.c:+Functions | |
| EXPORT bool | _strisascii_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT bool _strisascii_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "mem/mem_primitives_lib.h"
Include dependency graph for mem_primitives_lib.c:+Macros | |
| #define | wsize sizeof(uint32_t) |
| #define | wmask (wsize - 1) |
+Functions | |
| void | mem_prim_set (void *dest, uint32_t len, uint8_t value) |
| void | mem_prim_set16 (uint16_t *dest, uint32_t len, uint16_t value) |
| Sets len uint16_t's starting at dest to the specified value. More... | |
| void | mem_prim_set32 (uint32_t *dest, uint32_t len, uint32_t value) |
| Sets len uint32_t's starting at dest to the specified value. More... | |
| void | mem_prim_move (void *dest, const void *src, uint32_t len) |
| Moves at most len of bytes from src to dest. More... | |
| void | mem_prim_move8 (uint8_t *dest, const uint8_t *src, uint32_t len) |
| Moves at most len of uint8_t's from src to dest. More... | |
| void | mem_prim_move16 (uint16_t *dest, const uint16_t *src, uint32_t len) |
| Moves at most len uint16_t's from src to dest. More... | |
| void | mem_prim_move32 (uint32_t *dest, const uint32_t *src, uint32_t len) |
| Moves at most len of uint32_t's from src to dest. More... | |
| #define wsize sizeof(uint32_t) | +
| #define wmask (wsize - 1) | +
| void mem_prim_set | +( | +void * | +dest, | +
| + | + | uint32_t | +len, | +
| + | + | uint8_t | +value | +
| + | ) | ++ |
| void mem_prim_set16 | +( | +uint16_t * | +dest, | +
| + | + | uint32_t | +len, | +
| + | + | uint16_t | +value | +
| + | ) | ++ |
Sets len uint16_t's starting at dest to the specified value.
+Pointers must meet system alignment requirements.
+| [out] | dest | pointer to memory that will be set to value |
| [in] | len | number of uint16_t's to be set |
| [in] | value | uint16_t value |
| void mem_prim_set32 | +( | +uint32_t * | +dest, | +
| + | + | uint32_t | +len, | +
| + | + | uint32_t | +value | +
| + | ) | ++ |
Sets len uint32_t's starting at dest to the specified value.
+Pointers must meet system alignment requirements.
+| [out] | dest | pointer to memory that will be set to value |
| [in] | len | number of uint32_t's to be set |
| [in] | value | uint32_t value |
| void mem_prim_move | +( | +void * | +dest, | +
| + | + | const void * | +src, | +
| + | + | uint32_t | +len | +
| + | ) | ++ |
Moves at most len of bytes from src to dest.
+Dest may overlap with src.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | len | maximum number bytes of src that can be copied |
| void mem_prim_move8 | +( | +uint8_t * | +dest, | +
| + | + | const uint8_t * | +src, | +
| + | + | uint32_t | +len | +
| + | ) | ++ |
Moves at most len of uint8_t's from src to dest.
+The destination may overlap with source.
+| [out] | dest | pointer to the memory that will be replaced by src |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | len | maximum number uint8_t of src that can be copied |
| void mem_prim_move16 | +( | +uint16_t * | +dest, | +
| + | + | const uint16_t * | +src, | +
| + | + | uint32_t | +len | +
| + | ) | ++ |
Moves at most len uint16_t's from src to dest.
+The destination may overlap with source.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | len | maximum number uint16_t of src that can be copied |
| void mem_prim_move32 | +( | +uint32_t * | +dest, | +
| + | + | const uint32_t * | +src, | +
| + | + | uint32_t | +len | +
| + | ) | ++ |
Moves at most len of uint32_t's from src to dest.
+The destination may overlap with source.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | len | maximum number uint32_t of sp that can be copied |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_config.h"#include "safe_lib_errno.h"#include "safe_types.h"#include "safe_compile.h"#include <stdarg.h>#include <time.h>#include <wchar.h>
Include dependency graph for safe_str_lib.h:+Macros | |
| #define | EXTERN extern |
| #define | RSIZE_MIN_STR ( 1 ) |
| The shortest string is a null string!! More... | |
| #define | RSIZE_MAX_WSTR ( RSIZE_MAX_STR/sizeof(wchar_t) ) |
| wide chars More... | |
| #define | SAFE_STR_MIN_LOWERCASE ( 2 ) |
| The makeup of a password. More... | |
| #define | SAFE_STR_MIN_UPPERCASE ( 2 ) |
| #define | SAFE_STR_MIN_NUMBERS ( 1 ) |
| #define | SAFE_STR_MIN_SPECIALS ( 1 ) |
| #define | SAFE_STR_PASSWORD_MIN_LENGTH ( 6 ) |
| #define | SAFE_STR_PASSWORD_MAX_LENGTH ( 32 ) |
| #define | sl_default_handler ignore_handler_s |
| #define | strcat_s(dest, dmax, src) _strcat_s_chk(dest,dmax,src,BOS(dest)) |
| The strcat_s function appends a copy of the string pointed to by src (including the terminating null character) to the end of the string pointed to by dest. More... | |
| #define | strcpy_s(dest, dmax, src) _strcpy_s_chk(dest,dmax,src,BOS(dest)) |
| The strcpy_s function copies the string pointed to by src (including the terminating null character) into the array pointed to by dest. More... | |
| #define | strncat_s(dest, dmax, src, slen) _strncat_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| The strncat_s function appends a copy of the string pointed to by src (including the terminating null character) to the end of the string pointed to by dest. More... | |
| #define | strncpy_s(dest, dmax, src, slen) _strncpy_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| The strncpy_s function copies not more than slen successive characters (characters that follow a null character are not copied) from the array pointed to by src to the array pointed to by dest. More... | |
| #define | strnlen_s(str, smax) _strnlen_s_chk(str,smax,BOS(str)) |
The strnlen_s function computes the length of the string pointed to by str, refusing to read past smax. More... | |
| #define | strtok_s(dest, dmaxp, delim, ptr) _strtok_s_chk(dest,dmaxp,delim,ptr,BOS(dest)) |
| A sequence of calls to the strtok_s function breaks the string pointed to by dest into a sequence of tokens, each of which is delimited by a character from the string pointed to by delim. More... | |
| #define | vsprintf_s(dest, dmax, fmt, ap) _vsprintf_s_chk(dest,dmax,BOS(dest),fmt,ap) |
The vsprintf_s function composes a string with the same content that would be printed if format was used on printf. More... | |
| #define | vsnprintf_s(dest, dmax, fmt, ap) _vsnprintf_s_chk(dest,dmax,BOS(dest),fmt,ap) |
The truncating vsnprintf_s function composes a string with same test that would be printed if format was used on printf. More... | |
| #define | strerror_s(dest, dmax, errnum) _strerror_s_chk(dest,dmax,errnum,BOS(dest)) |
The strerror_s function returns a pointer to the textual description of the system error code errnum, identical to the description that would be printed by perror(). More... | |
| #define | strcmp_s(dest, dmax, src, resultp) _strcmp_s_chk(dest,dmax,src,resultp,BOS(dest),BOS(src)) |
| Compares string src to string dest. More... | |
| #define | strcasecmp_s(dest, dmax, src, resultp) _strcasecmp_s_chk(dest,dmax,src,resultp,BOS(dest)) |
| Case insensitive string comparison by converting to uppercase prior to the compare. More... | |
| #define | strnatcmp_s(dest, dmax, src, resultp) _strnatcmp_s_chk(dest,dmax,src,0,resultp,BOS(dest),BOS(src)) |
| Natural order comparison of strings. More... | |
| #define | strnatcasecmp_s(dest, dmax, src, resultp) _strnatcasecmp_s_chk(dest,dmax,src,1,resultp,BOS(dest),BOS(src)) |
| #define | strcasestr_s(dest, dmax, src, slen, substring) _strcasestr_s_chk(dest,dmax,src,slen,substring,BOS(dest),BOS(src)) |
| The strcasestr_s() function locates the first occurrence of the substring pointed to by src which would be located in the string pointed to by dest. More... | |
| #define | strcmpfld_s(dest, dmax, src, resultp) _strcmpfld_s_chk(dest,dmax,src,resultp,BOS(dest)) |
| Compares the character array pointed to by src to the character array pointed to by dest for dmax characters. More... | |
| #define | strcpyfld_s(dest, dmax, src, slen) _strcpyfld_s_chk(dest,dmax,src,slen,BOS(dest)) |
| #define | strcpyfldin_s(dest, dmax, src, slen) _strcpyfldin_s_chk(dest,dmax,src,slen,BOS(dest)) |
| #define | strcpyfldout_s(dest, dmax, src, slen) _strcpyfldout_s_chk(dest,dmax,src,slen,BOS(dest)) |
| #define | strcspn_s(dest, dmax, src, slen, countp) _strcspn_s_chk(dest,dmax,src,slen,countp,BOS(dest),BOS(src)) |
| This function computes the prefix length of the string pointed to by dest which consists entirely of characters that are excluded from the string pointed to by src. More... | |
| #define | strfirstchar_s(dest, dmax, c, firstp) _strfirstchar_s_chk(dest,dmax,c,firstp,BOS(dest)) |
| This function returns a pointer to the first occurrence of character c in dest. More... | |
| #define | strfirstdiff_s(dest, dmax, src, resultp) _strfirstdiff_s_chk(dest,dmax,src,resultp,BOS(dest)) |
| Returns the index of the first character that is different between dest and src. More... | |
| #define | strisalphanumeric_s(dest, dmax) _strisalphanumeric_s_chk(dest,dmax,BOS(dest)) |
| This function checks if the entire string contains alphanumerics. More... | |
| #define | strisascii_s(dest, dmax) _strisascii_s_chk(dest,dmax,BOS(dest)) |
| This function checks if the entire string contains ascii characters. More... | |
| #define | strisdigit_s(dest, dmax) _strisdigit_s_chk(dest,dmax,BOS(dest)) |
| This function checks that the entire string contains digits. More... | |
| #define | strishex_s(dest, dmax) _strishex_s_chk(dest,dmax,BOS(dest)) |
| This function checks that the entire string contains hex characters. More... | |
| #define | strislowercase_s(dest, dmax) _strislowercase_s_chk(dest,dmax,BOS(dest)) |
| This function checks if entire string is lowercase. More... | |
| #define | strismixedcase_s(dest, dmax) _strismixedcase_s_chk(dest,dmax,BOS(dest)) |
| This function checks that the entire string is mixed case. More... | |
| #define | strispassword_s(dest, dmax) _strispassword_s_chk(dest,dmax,BOS(dest)) |
| This function validates the make-up of a password string. More... | |
| #define | strisuppercase_s(dest, dmax) _strisuppercase_s_chk(dest,dmax,BOS(dest)) |
| This function checks if entire string is uppercase The scanning stops at the first null or after dmax characters. More... | |
| #define | strlastchar_s(dest, dmax, c, lastp) _strlastchar_s_chk(dest,dmax,c,lastp,BOS(dest)) |
| Returns a pointer to the last occurrence of character c in dest. More... | |
| #define | strlastdiff_s(dest, dmax, src, resultp) _strlastdiff_s_chk(dest,dmax,src,resultp,BOS(dest)) |
| Returns the index of the last character that is different between dest and src. More... | |
| #define | strljustify_s(dest, dmax) _strljustify_s_chk(dest,dmax,BOS(dest)) |
| Removes beginning whitespace from the string pointed to by dest by shifting the text left over writting the beginning whitespace, left justifying the text. More... | |
| #define | strnterminate_s(dest, dmax) _strnterminate_s_chk(dest,dmax,BOS(dest)) |
| The strnterminate_s function will terminate the string if a null is not encountered before dmax characters. More... | |
| #define | strpbrk_s(dest, dmax, src, slen, firstp) _strpbrk_s_chk(dest,dmax,src,slen,firstp,BOS(dest),BOS(src)) |
| Returns a pointer, first, to the first ocurrence of any character in src which is contained in dest. More... | |
| #define | strfirstsame_s(dest, dmax, src, resultp) _strfirstsame_s_chk(dest,dmax,src,resultp,BOS(dest)) |
| Returns the index of the first character that is the same between dest and src. More... | |
| #define | strlastsame_s(dest, dmax, src, resultp) _strlastsame_s_chk(dest,dmax,src,resultp,BOS(dest)) |
| Returns the index of the last character that is the same between dest and src. More... | |
| #define | strprefix_s(dest, dmax, src) _strprefix_s_chk(dest,dmax,src,BOS(dest)) |
| Determines if the prefix pointed to by src is at the beginning of string pointed to by dest. More... | |
| #define | strremovews_s(dest, dmax) _strremovews_s_chk(dest,dmax,BOS(dest)) |
| Removes beginning and trailing whitespace from the string pointed to by dest by shifting the text left over writting the beginning whitespace (space or tab). More... | |
| #define | strspn_s(dest, dmax, src, slen, countp) _strspn_s_chk(dest,dmax,src,slen,countp,BOS(dest),BOS(src)) |
| This function computes the prefix length of the string pointed to by dest which consists entirely of characters that are included from the string pointed to by src. More... | |
| #define | strstr_s(dest, dmax, src, slen, substringp) _strstr_s_chk(dest,dmax,src,slen,substringp,BOS(dest),BOS(src)) |
| The strstr_s() function locates the first occurrence of the substring pointed to by src which would be located in the string pointed to by dest. More... | |
| #define | strchr_s(dest, dmax, ch, resultp) _strchr_s_chk(dest,dmax,ch,resultp,BOS(dest)) |
| Finds the first occurrence of ch (after conversion to char as if by (char)ch) in the null-terminated byte string pointed to by dest (each character interpreted as unsigned char). More... | |
| #define | strrchr_s(dest, dmax, ch, resultp) _strrchr_s_chk(dest,dmax,ch,resultp,BOS(dest)) |
| Finds the last occurrence of ch (after conversion to char as if by (char)ch) in the null-terminated byte string pointed to by dest (each character interpreted as unsigned char). More... | |
| #define | strtolowercase_s(dest, dmax) _strtolowercase_s_chk(dest,dmax,BOS(dest)) |
| Converts all uppercase characters to lowercase, leaving all other characters unchanged. More... | |
| #define | strtouppercase_s(dest, dmax) _strtouppercase_s_chk(dest,dmax,BOS(dest)) |
| Converts all lowercase characters to uppercase, leaving all other characters unchanged. More... | |
| #define | strlwr_s(str, slen) strtolowercase_s((str), (slen)) |
| #define | strupr_s(str, slen) strtouppercase_s((str), (slen)) |
| #define | strzero_s(dest, dmax) _strzero_s_chk(dest,dmax,BOS(dest)) |
| Nulls maximal dmax characters of dest. More... | |
| #define | strcoll_s(dest, dmax, src, resultp) _strcoll_s_chk(dest,dmax,src,resultp,BOS(dest)) |
Compares two null-terminated byte strings according to the current locale as defined by the LC_COLLATE category. More... | |
| #define | strset_s(dest, dmax, value) _strset_s_chk(dest,dmax,value,BOS(dest)) |
| Sets maximal dmax characters of dest to a character value, but not the final NULL character. More... | |
| #define | strnset_s(dest, dmax, value, n) _strnset_s_chk(dest,dmax,value,n,BOS(dest)) |
| Sets maximal n characters of dest to a character value, but not the final NULL character. More... | |
| #define | mbstowcs_s(retvalp, dest, dmax, src, len) _mbstowcs_s_chk(retvalp,dest,dmax,src,len,BOS(dest)) |
| #define | mbsrtowcs_s(retvalp, dest, dmax, srcp, len, ps) _mbsrtowcs_s_chk(retvalp,dest,dmax,srcp,len,ps,BOS(dest)) |
Does not permit the ps parameter (the pointer to the conversion state) to be a null pointer. More... | |
| #define | wcsrtombs_s(retvalp, dest, dmax, srcp, len, ps) _wcsrtombs_s_chk(retvalp,dest,dmax,srcp,len,ps,BOS(dest)) |
Does not permit the ps parameter (the pointer to the conversion state) to be a null pointer. More... | |
| #define | wcstombs_s(retvalp, dest, dmax, src, len) _wcstombs_s_chk(retvalp,dest,dmax,src,len,BOS(dest)) |
The wcstombs_s function converts a sequence of wide characters from the array whose first element is pointed to by src to to its narrow multibyte representation from the current LC_CTYPE locale. More... | |
| #define | wcrtomb_s(retvalp, dest, dmax, wc, ps) _wcrtomb_s_chk(retvalp,dest,dmax,wc,ps,BOS(dest)) |
Does not permit the ps parameter (the pointer to the conversion state) to be a null pointer. More... | |
| #define | wctomb_s(retvalp, dest, dmax, wc) _wctomb_s_chk(retvalp,dest,dmax,wc,BOS(dest)) |
The wctomb_s function converts a single wide character to its narrow multibyte representation from the current LC_CTYPE locale. More... | |
| #define | wcsnlen_s(dest, dmax) _wcsnlen_s_chk(dest,dmax,BOS(dest)) |
| The wcsnlen_s function computes the length of the wide string pointed to by dest, providing limited support for non-null terminated strings. More... | |
| #define | wcscpy_s(dest, dmax, src) _wcscpy_s_chk(dest,dmax,src,BOS(dest)) |
The wcscpy_s function copies the string pointed to by src (including the terminating null character) into the array pointed to by dest. More... | |
| #define | wcsncpy_s(dest, dmax, src, slen) _wcsncpy_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| The wcsncpy_s function copies the wide string pointed to by src (including the terminating null character) into the wide string pointed to by dest. More... | |
| #define | wcscat_s(dest, dmax, src) _wcscat_s_chk(dest,dmax,src,BOS(dest)) |
| The wcscat_s function appends a copy of the wide string pointed to by src (including the terminating null character) to the end of the wide string pointed to by dest. More... | |
| #define | wcsncat_s(dest, dmax, src, slen) _wcsncat_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) |
| The wcsncat_s function appends a copy of the wide string pointed to by src (including the terminating null wide character) to the end of the wide string pointed to by dest. More... | |
| #define | wcstok_s(dest, dmaxp, delim, ptr) _wcstok_s_chk(dest,dmaxp,delim,ptr,BOS(dest)) |
| A sequence of calls to the wcstok_s function breaks the string pointed to by dest into a sequence of tokens, each of which is delimited by a character from the string pointed to by delim. More... | |
| #define | vswprintf_s(dest, dmax, fmt, ap) _vswprintf_s_chk(dest,dmax,BOS(dest),fmt,ap) |
| #define | vsnwprintf_s(dest, dmax, fmt, ap) _vsnwprintf_s_chk(dest,dmax,BOS(dest),fmt,ap) |
The truncating vsnwprintf_s function composes a wide string with same test that would be printed if format was used on wprintf. More... | |
| #define | wcsstr_s(dest, dmax, src, slen, substringp) _wcsstr_s_chk(dest,dmax,src,slen,substringp,BOS(dest),BOS(src)) |
The wcsstr_s() function locates the first occurrence of the wide substring pointed to by src which would be located in the wide string pointed to by dest. More... | |
| #define | wcscmp_s(dest, dmax, src, smax, resultp) _wcscmp_s_chk(dest,dmax,src,smax,resultp,BOS(dest),BOS(src)) |
| Compares wide string src to wide string dest. More... | |
| #define | wcsncmp_s(dest, dmax, src, smax, count, resultp) _wcsncmp_s_chk(dest,dmax,src,smax,count,resultp,BOS(dest),BOS(src)) |
| Compares at most count wide characters of wide string src with wide string dest, and returns if difference in the last parameter. More... | |
| #define | wcsicmp_s(dest, dmax, src, smax, resultp) _wcsicmp_s_chk(dest,dmax,src,smax,resultp,BOS(dest),BOS(src)) |
Compares two wide strings case-folded, via wcsfc_s(), i.e. More... | |
| #define | wcsnatcmp_s(dest, dmax, src, smax, resultp) _wcsnatcmp_s_chk(dest,dmax,src,smax,0,resultp,BOS(dest),BOS(src)) |
| #define | wcsnaticmp_s(dest, dmax, src, smax, resultp) _wcsnatcmp_s_chk(dest,dmax,src,smax,1,resultp,BOS(dest),BOS(src)) |
| Natural order comparison of strings. More... | |
| #define | wcsset_s(dest, dmax, value) _wcsset_s_chk(dest,dmax,value,BOS(dest)) |
| Sets maximal dmax wide characters of dest to a wide character value, but not the final NULL character. More... | |
| #define | wcsnset_s(dest, dmax, value, n) _wcsnset_s_chk(dest,dmax,value,n,BOS(dest)) |
| Sets maximal n wide characters of dest to a wide character value, but not the final NULL character. More... | |
| #define | wcscoll_s(dest, dmax, src, smax, resultp) _wcscoll_s_chk(dest,dmax,src,smax,resultp,BOS(dest),BOS(src)) |
Compares two null-terminated wide strings according to the current locale as defined by the LC_COLLATE category. More... | |
| #define | wcslwr_s(src, slen) _wcslwr_s_chk(src,slen,BOS(src)) |
| Scans the string converting uppercase characters to simple lowercase, leaving all other characters unchanged. More... | |
| #define | wcsupr_s(src, slen) _wcsupr_s_chk(src,slen,BOS(src)) |
| Scans the string converting lowercase characters to uppercase, leaving all other characters unchanged. More... | |
| #define | towfc_s(dest, dmax, src) _towfc_s_chk(dest,dmax,src,BOS(dest)) |
towfc_s() converts a wide character to fully fold-cased (lowercased with possible expansions), according to the Unicode 10.0 CaseFolding table. More... | |
| #define | wcsfc_s(dest, dmax, src, lenp) _wcsfc_s_chk(dest,dmax,src,lenp,BOS(dest)) |
| Converts the wide string via full case-folding NFD normalized to lowercase. More... | |
| #define | wcsnorm_decompose_s(dest, dmax, src, lenp, iscompat) _wcsnorm_decompose_s_chk(dest,dmax,src,lenp,iscompat,BOS(dest)) |
| Converts the wide string to the canonical NFD normalization, as defined in the latest Unicode standard, latest 10.0. More... | |
| #define | wcsnorm_reorder_s(dest, dmax, src, len) _wcsnorm_reorder_s_chk(dest,dmax,src,len,BOS(dest)) |
| Reorder all decomposed sequences in a wide string to NFD, as defined in the latest Unicode standard, latest 10.0. More... | |
| #define | wcsnorm_compose_s(dest, dmax, src, lenp, iscontig) _wcsnorm_compose_s_chk(dest,dmax,src,lenp,iscontig,BOS(dest)) |
| Combine all decomposed sequences in a wide string to NFC, as defined in the latest Unicode standard, latest 10.0. More... | |
| #define | wcsnorm_s(dest, dmax, src, mode, lenp) _wcsnorm_s_chk(dest,dmax,src,mode,lenp,BOS(dest)) |
| Converts the wide string to the canonical NFC or NFD normalization, as defined in the latest Unicode standard, latest 10.0. More... | |
+Functions | |
| EXTERN void | abort_handler_s (const char *restrict msg, void *restrict ptr, errno_t error) |
| This function writes a message on the standard error stream in an implementation-defined format. More... | |
| EXTERN void | ignore_handler_s (const char *restrict msg, void *restrict ptr, errno_t error) |
| This function simply returns to the caller. More... | |
| EXTERN constraint_handler_t | set_str_constraint_handler_s (constraint_handler_t handler) |
| The set_str_constraint_handler_s function sets the runtime-constraint handler to be handler. More... | |
| EXTERN errno_t | _strcat_s_chk (char *restrict dest, rsize_t dmax, const char *restrict src, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) |
| EXTERN errno_t | _strcpy_s_chk (char *restrict dest, rsize_t dmax, const char *restrict src, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) |
| EXTERN errno_t | _strncat_s_chk (char *restrict dest, rsize_t dmax, const char *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) BOS_ATTR((slen||dest||dmax) &&(_BOS_NULL(dest)||_BOS_ZERO(dest |
| EXTERN errno_t empty dest or dmax | BOS_ATTR ((slen||dest||dmax) &&_BOS_OVR(dest, dmax), "dest overflow") BOS_OVR2_BUTZERO(src |
| EXTERN errno_t | _strncpy_s_chk (char *restrict dest, rsize_t dmax, const char *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_OVR2_BUTZERO(src |
| EXTERN rsize_t | _strnlen_s_chk (const char *str, rsize_t smax, const size_t strbos) BOS_CHK2(str |
| EXTERN char * | _strtok_s_chk (char *restrict dest, rsize_t *restrict dmaxp, const char *restrict delim, char **restrict ptr, const size_t destbos) BOS_NULL(ptr) |
| EXTERN int | sprintf_s (char *restrict dest, rsize_t dmax, const char *restrict fmt,...) BOS_CHK(dest) BOS_FMT(fmt) |
| EXTERN int | _vsprintf_s_chk (char *restrict dest, rsize_t dmax, const size_t destbos, const char *restrict fmt, va_list ap) BOS_CHK(dest) BOS_FMT(fmt) |
| EXTERN int | snprintf_s (char *restrict dest, rsize_t dmax, const char *restrict fmt,...) BOS_CHK(dest) BOS_FMT(fmt) |
| EXTERN int | _vsnprintf_s_chk (char *restrict dest, rsize_t dmax, const size_t destbos, const char *restrict fmt, va_list ap) BOS_CHK(dest) BOS_FMT(fmt) |
| EXTERN int | sscanf_s (const char *restrict buffer, const char *restrict fmt,...) BOS_NULL(buffer) BOS_FMT(fmt) |
The sscanf_s function reads a formatted string, and writes to a list of arguments. More... | |
| EXTERN int | fscanf_s (FILE *restrict stream, const char *restrict fmt,...) BOS_NULL(stream) BOS_FMT(fmt) |
The fscanf_s function reads a formatted string from a buffered FILE stream, and writes to a list of arguments. More... | |
| EXTERN int | scanf_s (const char *restrict fmt,...) BOS_FMT(fmt) |
The scanf_s function reads a formatted string from stdin, and writes to a list of arguments. More... | |
| EXTERN int | vscanf_s (const char *restrict fmt, va_list ap) BOS_FMT(fmt) |
The vscanf_s function reads a formatted string from stdin, and writes to a list of arguments. More... | |
| EXTERN int | vfscanf_s (FILE *restrict stream, const char *restrict fmt, va_list ap) BOS_NULL(stream) BOS_FMT(fmt) |
The vfscanf_s function reads a formatted string from a buffered FILE stream, and writes to a list of arguments. More... | |
| EXTERN int | vsscanf_s (const char *restrict dest, const char *restrict fmt, va_list ap) BOS_NULL(dest) BOS_FMT(fmt) |
The vsscanf_s function reads a formatted string, and writes to a list of arguments. More... | |
| EXTERN int | printf_s (const char *restrict fmt,...) BOS_FMT(fmt) |
| The printf_s function composes a string via the format string and writes it to a FILE buffer. More... | |
| EXTERN int | fprintf_s (FILE *restrict stream, const char *restrict fmt,...) BOS_FMT(fmt) |
| The fprintf_s function composes a string via the format string and writes it to a FILE buffer. More... | |
| EXTERN int | vprintf_s (const char *restrict fmt, va_list ap) BOS_FMT(fmt) |
| The vprintf_s function composes a string via the format string and writes it to a FILE buffer. More... | |
| EXTERN int | vfprintf_s (FILE *restrict stream, const char *restrict fmt, va_list arg) BOS_FMT(fmt) |
| The vfprintf_s function composes a string via the format string and writes it to a FILE buffer. More... | |
| EXTERN errno_t | _strerror_s_chk (char *dest, rsize_t dmax, errno_t errnum, const size_t destbos) BOS_CHK(dest) |
| EXTERN size_t | strerrorlen_s (errno_t errnum) |
The strerrorlen_s function returns the untruncated length of the textual description of the system error code errnum, identical to the description that would be printed by perror(). More... | |
| EXTERN errno_t | _strcmp_s_chk (const char *dest, rsize_t dmax, const char *src, int *resultp, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN errno_t | _strcasecmp_s_chk (const char *dest, rsize_t dmax, const char *src, int *resultp, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN errno_t | _strnatcmp_s_chk (const char *dest, rsize_t dmax, const char *src, const int fold_case, int *resultp, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN errno_t | _strcasestr_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, char **substring, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_CHK2(src |
| EXTERN errno_t slen | BOS_NULL (substring) |
| EXTERN errno_t | _strcmpfld_s_chk (const char *dest, rsize_t dmax, const char *src, int *resultp, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN errno_t | _strcpyfld_s_chk (char *dest, const rsize_t dmax, const char *src, rsize_t slen, const size_t destbos) BOS_CHK_BUTZERO(dest |
| EXTERN errno_t slen | BOS_OVR2_BUTZERO (src, slen) VAL_OVR2(slen |
| EXTERN errno_t | _strcpyfldin_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, const size_t destbos) BOS_CHK_BUTZERO(dest |
| EXTERN errno_t | _strcpyfldout_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, const size_t destbos) BOS_CHK_BUTZERO(dest |
| EXTERN errno_t | _strcspn_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t slen, rsize_t *countp, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_OVR2(src |
| EXTERN errno_t slen | BOS_NULL (countp) |
| EXTERN errno_t | _strfirstchar_s_chk (char *dest, rsize_t dmax, char c, char **firstp, const size_t destbos) BOS_CHK(dest) BOS_NULL(firstp) |
| EXTERN errno_t | _strfirstdiff_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t *resultp, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN bool | _strisalphanumeric_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN bool | _strisascii_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN bool | _strisdigit_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN bool | _strishex_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN bool | _strislowercase_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN bool | _strismixedcase_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN bool | _strispassword_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN bool | _strisuppercase_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN errno_t | _strlastchar_s_chk (char *dest, rsize_t dmax, char c, char **lastp, const size_t destbos) BOS_CHK(dest) BOS_NULL(lastp) |
| EXTERN errno_t | _strlastdiff_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t *resultp, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN errno_t | _strljustify_s_chk (char *dest, rsize_t dmax, const size_t destbos) BOS_CHK(dest) |
| EXTERN rsize_t | _strnterminate_s_chk (char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN errno_t | _strpbrk_s_chk (char *dest, rsize_t dmax, char *src, rsize_t slen, char **firstp, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_OVR2(src |
| EXTERN errno_t slen | BOS_NULL (firstp) |
| EXTERN errno_t | _strfirstsame_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t *resultp, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN errno_t | _strlastsame_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t *resultp, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN errno_t | _strprefix_s_chk (const char *dest, rsize_t dmax, const char *src, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) |
| EXTERN errno_t | _strremovews_s_chk (char *dest, rsize_t dmax, const size_t destbos) BOS_CHK(dest) |
| EXTERN errno_t | _strspn_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t slen, rsize_t *countp, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_CHK2(src |
| EXTERN errno_t | _strstr_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, char **substringp, const size_t destbos, const size_t srcbos) BOS_CHK(dest) BOS_OVR2(src |
| EXTERN errno_t slen | BOS_NULL (substringp) |
| EXTERN errno_t | _strchr_s_chk (const char *restrict dest, rsize_t dmax, const int ch, char **restrict resultp, const size_t destbos) BOS_CHK(dest) VAL_OVR2(ch |
| EXTERN errno_t | BOS_NULL (resultp) |
| EXTERN errno_t | _strrchr_s_chk (const char *restrict dest, rsize_t dmax, const int ch, char **restrict resultp, const size_t destbos) BOS_CHK(dest) VAL_OVR2(ch |
| EXTERN errno_t | _strtolowercase_s_chk (char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN errno_t | _strtouppercase_s_chk (char *dest, rsize_t dmax, const size_t destbos) BOS_CHK2(dest |
| EXTERN errno_t | _strzero_s_chk (char *dest, rsize_t dmax, const size_t destbos) BOS_CHK(dest) |
| EXTERN errno_t | _strcoll_s_chk (const char *restrict dest, rsize_t dmax, const char *restrict src, int *resultp, const size_t destbos) BOS_CHK(dest) BOS_NULL(src) BOS_NULL(resultp) |
| EXTERN errno_t | _strset_s_chk (char *restrict dest, rsize_t dmax, int value, const size_t destbos) BOS_CHK(dest) VAL_OVR2(value |
| EXTERN errno_t | _strnset_s_chk (char *restrict dest, rsize_t dmax, int value, rsize_t n, const size_t destbos) BOS_CHK(dest) BOS_OVR2_BUTZERO(dest |
| EXTERN errno_t n | VAL_OVR2 (value, 255) VAL_OVR2_BUTZERO(n |
| EXTERN errno_t | _mbstowcs_s_chk (size_t *restrict retvalp, wchar_t *restrict dest, rsize_t dmax, const char *restrict src, rsize_t len, const size_t destbos) BOS_ATTR(!_BOS_NULL(dest) &&_BOS_ZERO(dest |
| EXTERN errno_t empty dmax | BOS_ATTR (!_BOS_NULL(dest) &&_BOSW_OVR(dest, dmax), "dest overflow") BOS_ATTR(!_BOS_NULL(dest) &&(void *) dest == *srcp |
| EXTERN errno_t empty dmax dest overlap | BOS_CHK2 (src, len) |
| EXTERN errno_t | _mbsrtowcs_s_chk (size_t *restrict retvalp, wchar_t *restrict dest, rsize_t dmax, const char **restrict srcp, rsize_t len, mbstate_t *restrict ps, const size_t destbos) BOS_NULL(retvalp) BOS_NULL(srcp) BOS_NULL(ps) BOS_ATTR(!_BOS_NULL(dest) &&_BOS_ZERO(dest |
| EXTERN errno_t empty dmax dest overlap | BOS_ATTR (dmax &&len > dmax, "len overflow >dmax") |
| EXTERN errno_t | _wcsrtombs_s_chk (size_t *restrict retvalp, char *restrict dest, rsize_t dmax, const wchar_t **restrict srcp, rsize_t len, mbstate_t *restrict ps, const size_t destbos) BOS_NULL(retvalp) BOS_NULL(ps) BOS_ATTR(!_BOS_NULL(dest) &&_BOS_OVR(dest |
| EXTERN errno_t dest overflow | BOS_ATTR (!_BOS_NULL(dest) &&(void *) dest==(void *) srcp, "dest overlap") BOS_ATTR(dmax &&len > dmax |
| EXTERN errno_t | _wcstombs_s_chk (size_t *restrict retvalp, char *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t len, const size_t destbos) BOS_NULL(retvalp) BOS_CHK(dest) BOSW_CHK2(src |
| EXTERN errno_t | _wcrtomb_s_chk (size_t *restrict retvalp, char *restrict dest, rsize_t dmax, wchar_t wc, mbstate_t *restrict ps, const size_t destbos) BOS_NULL(retvalp) BOS_CHK(dest) BOS_NULL(ps) VAL_OVR2(wc |
| EXTERN errno_t | _wctomb_s_chk (int *restrict retvalp, char *restrict dest, rsize_t dmax, wchar_t wc, const size_t destbos) BOS_ATTR(!_BOS_NULL(dest) &&(!dmax||dmax > RSIZE_MAX_STR||_BOS_OVR(dest |
| EXTERN errno_t dest overflow or empty | VAL_OVR2 (wc, 0x10ffff) |
| EXTERN size_t | _wcsnlen_s_chk (const wchar_t *dest, size_t dmax, const size_t destbos) BOSW_CHK(dest) |
| EXTERN errno_t | _wcscpy_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, const size_t destbos) BOSW_CHK(dest) BOS_NULL(src) |
| EXTERN errno_t | _wcsncpy_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) BOSW_CHK(dest) BOSW_OVR2(src |
| EXTERN errno_t | _wcscat_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, const size_t destbos) BOSW_CHK(dest) BOS_NULL(src) |
| EXTERN errno_t | _wcsncat_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) BOS_ATTR(slen &&(_BOS_NULL(dest)||_BOS_ZERO(dest |
| EXTERN errno_t dmax empty dest or dmax | BOS_ATTR (slen &&(_BOSW_OVR(src, slen)||_BOS_NULL(src)), "src overflow or empty") |
| EXTERN wchar_t * | _wcstok_s_chk (wchar_t *restrict dest, rsize_t *restrict dmaxp, const wchar_t *restrict delim, wchar_t **restrict ptr, const size_t destbos) BOS_NULL(ptr) |
| EXTERN int | swprintf_s (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict fmt,...) BOSW_CHK(dest) BOS_FMT(fmt) |
| EXTERN int | _vswprintf_s_chk (wchar_t *restrict dest, rsize_t dmax, const size_t destbos, const wchar_t *restrict fmt, va_list ap) BOSW_CHK(dest) BOS_FMT(fmt) |
| EXTERN int | snwprintf_s (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict fmt,...) BOSW_CHK(dest) BOS_FMT(fmt) |
| EXTERN int | _vsnwprintf_s_chk (wchar_t *restrict dest, rsize_t dmax, const size_t destbos, const wchar_t *restrict fmt, va_list ap) BOSW_CHK(dest) BOS_FMT(fmt) |
| EXTERN int | wprintf_s (const wchar_t *restrict fmt,...) BOS_FMT(fmt) |
| The wprintf_s function prints formatted output to stdout as wide string. More... | |
| EXTERN int | vwprintf_s (const wchar_t *restrict fmt, va_list ap) BOS_FMT(fmt) |
| The vwprintf_s function prints formatted output to stdout as wide string. More... | |
| EXTERN int | fwprintf_s (FILE *restrict stream, const wchar_t *restrict fmt,...) BOS_NULL(stream) BOS_FMT(fmt) |
| The fwprintf_s function prints formatted output to a wide stream. More... | |
| EXTERN int | vfwprintf_s (FILE *restrict stream, const wchar_t *restrict fmt, va_list ap) BOS_NULL(stream) BOS_FMT(fmt) |
| The vfwprintf_s function prints formatted output to a wide stream. More... | |
| EXTERN int | swscanf_s (const wchar_t *restrict src, const wchar_t *restrict fmt,...) BOS_NULL(src) BOS_FMT(fmt) |
| The swscanf_s function reads a formatted wide string. More... | |
| EXTERN int | vswscanf_s (const wchar_t *restrict src, const wchar_t *restrict fmt, va_list ap) BOS_NULL(src) BOS_FMT(fmt) |
| The vswscanf_s function reads a formatted wide string. More... | |
| EXTERN int | wscanf_s (const wchar_t *restrict fmt,...) BOS_FMT(fmt) |
The wscanf_s function reads a formatted wide string from stdin. More... | |
| EXTERN int | vwscanf_s (const wchar_t *restrict fmt, va_list ap) BOS_FMT(fmt) |
The vwscanf_s function reads a formatted wide string from stdin. More... | |
| EXTERN int | fwscanf_s (FILE *restrict stream, const wchar_t *restrict fmt,...) BOS_NULL(stream) BOS_FMT(fmt) |
The fwscanf_s function reads a formatted wide string. More... | |
| EXTERN int | vfwscanf_s (FILE *restrict stream, const wchar_t *restrict fmt, va_list ap) BOS_NULL(stream) BOS_FMT(fmt) |
The vfwscanf_s function reads a formatted wide string. More... | |
| EXTERN errno_t | _wcsstr_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t slen, wchar_t **restrict substringp, const size_t destbos, const size_t srcbos) BOSW_CHK(dest) BOSW_OVR2(src |
| EXTERN errno_t | _wcscmp_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, int *resultp, const size_t destbos, const size_t srcbos) BOSW_CHK(dest) BOSW_CHK2(src |
| EXTERN errno_t | _wcsncmp_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, rsize_t count, int *resultp, const size_t destbos, const size_t srcbos) BOSW_CHK(dest) BOSW_CHK2(src |
| EXTERN errno_t | _wcsicmp_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, int *resultp, const size_t destbos, const size_t srcbos) BOSW_CHK(dest) BOSW_CHK2(src |
| EXTERN errno_t | _wcsnatcmp_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, const int fold_case, int *resultp, const size_t destbos, const size_t srcbos) BOSW_CHK(dest) BOSW_CHK2(src |
| EXTERN errno_t | _wcsset_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t value, const size_t destbos) BOSW_CHK(dest) VAL_OVR2(value |
| EXTERN errno_t | _wcsnset_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t value, size_t n, const size_t destbos) BOSW_CHK(dest) VAL_OVR2(value |
| EXTERN errno_t | _wcscoll_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, int *resultp, const size_t destbos, const size_t srcbos) BOSW_CHK(dest) BOSW_CHK2(src |
| EXTERN errno_t | _wcslwr_s_chk (wchar_t *restrict src, rsize_t slen, const size_t srcbos) BOSW_OVR2_BUTZERO(src |
| EXTERN errno_t | _wcsupr_s_chk (wchar_t *restrict src, rsize_t slen, const size_t srcbos) BOSW_OVR2_BUTZERO(src |
| EXTERN int | iswfc (const uint32_t wc) VAL_OVR2(wc |
| EXTERN int EXTERN int | _towfc_s_chk (wchar_t *restrict dest, rsize_t dmax, const uint32_t src, const size_t destbos) BOSW_CHK(dest) BOS_ATTR(dmax< 4 |
+Variables | |
| EXTERN errno_t | dmax |
| EXTERN errno_t empty dest or dmax | slen |
| EXTERN rsize_t | smax |
| EXTERN errno_t empty * | dest |
| EXTERN errno_t dmax | !dmax |
| #define EXTERN extern | +
| #define RSIZE_MIN_STR ( 1 ) | +
The shortest string is a null string!!
+ +| #define RSIZE_MAX_WSTR ( RSIZE_MAX_STR/sizeof(wchar_t) ) | +
wide chars
+ +| #define SAFE_STR_MIN_LOWERCASE ( 2 ) | +
The makeup of a password.
+ +| #define SAFE_STR_MIN_UPPERCASE ( 2 ) | +
| #define SAFE_STR_MIN_NUMBERS ( 1 ) | +
| #define SAFE_STR_MIN_SPECIALS ( 1 ) | +
| #define SAFE_STR_PASSWORD_MIN_LENGTH ( 6 ) | +
| #define SAFE_STR_PASSWORD_MAX_LENGTH ( 32 ) | +
| #define sl_default_handler ignore_handler_s | +
| #define strcat_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src | +
| + | ) | +_strcat_s_chk(dest,dmax,src,BOS(dest)) | +
The strcat_s function appends a copy of the string pointed to by src (including the terminating null character) to the end of the string pointed to by dest.
+The initial character from src overwrites the null character at the end of dest.
+All elements following the terminating null character (if any) written by strcat_s in the array of dmax characters pointed to by dest take unspecified values when strcat_s returns. With SAFECLIB_STR_NULL_SLACK defined the rest of dest is cleared with NULL bytes. With modern compilers and constant arguments most errors will be caught at compile-time.
+| [out] | dest | pointer to string that will be extended by src if dmax allows. The string is null terminated. If the resulting concatenated string is less than dmax, the remaining slack space is nulled. |
| [in] | dmax | restricted maximum length of the resulting dest, including the null |
| [in] | src | pointer to the string that will be concatenaed to string dest |
strncat_s.| EOK | when successful operation, all the characters from src were appended to dest and the result in dest is null terminated. |
| ESNULLP | when dest or src is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESUNTERM | when dest not terminated in the first dmax bytes |
| ESOVRLP | when src overlaps with dest |
| #define strcpy_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src | +
| + | ) | +_strcpy_s_chk(dest,dmax,src,BOS(dest)) | +
The strcpy_s function copies the string pointed to by src (including the terminating null character) into the array pointed to by dest.
+With SAFECLIB_STR_NULL_SLACK defined all elements following the terminating null character (if any) written by strcpy_s in the array of dmax characters pointed to by dest are nulled when strcpy_s returns. With modern compilers and constant arguments most errors will be caught at compile-time.
+| [out] | dest | pointer to string that will be replaced by src. |
| [in] | dmax | restricted maximum length of dest |
| [in] | src | pointer to the string that will be copied to dest |
| EOK | when successful operation, the characters in src were copied into dest and the result is null terminated. |
| ESNULLP | when dest or src is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESOVRLP | when strings overlap |
| ESNOSPC | when dest < src |
| #define strncat_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_strncat_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
The strncat_s function appends a copy of the string pointed to by src (including the terminating null character) to the end of the string pointed to by dest.
+The initial character from src overwrites the null character at the end of dest.
+All elements following the terminating null character (if any) written by strncat_s in the array of dmax characters pointed to by dest take unspecified values when strncat_s returns. With SAFECLIB_STR_NULL_SLACK defined the rest is cleared with NULL bytes. With modern compilers and constant arguments most errors will be caught at compile-time.
+| [out] | dest | pointer to string that will be extended by src if dmax allows. The string is null terminated. If the resulting concatenated string is less than dmax, the remaining slack space is nulled. |
| [in] | dmax | restricted maximum length of the resulting dest, including the null |
| [in] | src | pointer to the string that will be concatenaed to string dest |
| [in] | slen | maximum characters to append |
| EOK | successful operation, when slen == 0 or all the characters are copied from src and dest is null terminated. As special case, analog to msvcrt: when slen == 0 and dmax is big enough for dest, also return EOK, but clear dest. |
| ESNULLP | when dest/src is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_STR |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESUNTERM | when dest not terminated |
| ESOVRLP | when src overlaps with dest |
If dmax != sizeof(dest): With –enable-warn-dmax ESLEWRNG will be passed to the constraint handler. With –enable-error-dmax this error will be fatal, but dest will not be cleared. With clang-5 and/or diagnose_if and __builtin_object_size() support wrong dmax values will be caught at compile-time.
+ + +| #define strncpy_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_strncpy_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
The strncpy_s function copies not more than slen successive characters (characters that follow a null character are not copied) from the array pointed to by src to the array pointed to by dest.
+If no null character was copied from src, then dest[n] is set to a null character, thus guaranteeing null termination.
+All elements following the terminating null character (if any) written by strncpy_s in the array of dmax characters pointed to by dest take unspecified values when strncpy_s returns. With SAFECLIB_STR_NULL_SLACK defined the rest is cleared with NULL bytes. With modern compilers and constant arguments most errors will be caught at compile-time.
+| [out] | dest | pointer to string that will be replaced by src. |
| [in] | dmax | restricted maximum length of dest |
| [in] | src | pointer to the string that will be copied to dest |
| [in] | slen | the maximum number of characters to copy from src |
| EOK | successful operation, when slen == 0 or the characters in src were copied to dest and the result is null terminated. |
| ESNULLP | when dest/src is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_STR |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESOVRLP | when strings overlap |
| ESNOSPC | when src longer than dest |
If dmax != sizeof(dest): With –enable-warn-dmax ESLEWRNG will be passed to the constraint handler. With –enable-error-dmax this error will be fatal, but dest will not be cleared.
+ + +| #define strnlen_s | +( | ++ | str, | +
| + | + | + | smax | +
| + | ) | +_strnlen_s_chk(str,smax,BOS(str)) | +
The strnlen_s function computes the length of the string pointed to by str, refusing to read past smax.
| str | pointer to string |
| smax | maximum length of string |
str 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 smax characters of str then strnlen_s returns smax. At most the first smax or sizeof(str) characters of str are accessed by strnlen_s.| #define strtok_s | +( | ++ | dest, | +
| + | + | + | dmaxp, | +
| + | + | + | delim, | +
| + | + | + | ptr | +
| + | ) | +_strtok_s_chk(dest,dmaxp,delim,ptr,BOS(dest)) | +
A sequence of calls to the strtok_s function breaks the string pointed to by dest into a sequence of tokens, each of which is delimited by a character from the string pointed to by delim.
+The fourth argument points to a caller-provided char pointer into which the strtok_s function stores information necessary for it to continue scanning the same string.
+The first call in a sequence has a non-null first argument and dmax points to an object whose value is the number of elements in the character array pointed to by the first argument. The first call stores an initial value in the object pointed to by ptr and updates the value pointed to by dmax to reflect the number of elements that remain in relation to ptr. Subsequent calls in the sequence have a null first argument and the objects pointed to by dmax and ptr are required to have the values stored by the previous call in the sequence, which are then updated. The separator string pointed to by delim may be different from call to call.
+The first call in the sequence searches the string pointed to by dest for the first character that is not contained in the current separator string pointed to by delim. If no such character is found, then there are no tokens in the string pointed to by dest and the strtok_s function returns a null pointer. If such a character is found, it is the start of the first token.
+The strtok_s function then searches from there for the first character in dest that is contained in the current separator string. If no such character is found, the current token extends to the end of the string pointed to by dest, and subsequent searches in the same string for a token return a null pointer. If such a character is found, it is overwritten by a null character, which terminates the current token.
+In all cases, the strtok_s function stores sufficient information in the pointer pointed to by ptr so that subsequent calls, with a null pointer for dest and the unmodified pointer value for ptr, shall start searching just past the element overwritten by a null character (if any).
+delim uses a STRTOK_DELIM_MAX_LEN of 16.
+| [in] | dest | pointer to string to tokenize |
| [out] | dmaxp | pointer to restricted maximum length of dest string |
| [in] | delim | pointer to delimiter string (len < 255) |
| [out] | ptr | returned pointer to token |
char* strtok_s (char *str, const char *delim, char **ctx)errno is set to: ESNULLP when dest/delim/ptr is NULL pointer ESZEROL when *dmax = 0 ESLEMAX when *dmax > RSIZE_MAX_STR EOVERFLOW when *dmax > size of dest ESLEWRNG when *dmax != size of dest and –enable-error-dmax ESUNTERM when unterminated string C11 just returns EINVAL
+| #define vsprintf_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | fmt, | +
| + | + | + | ap | +
| + | ) | +_vsprintf_s_chk(dest,dmax,BOS(dest),fmt,ap) | +
The vsprintf_s function composes a string with the same content that would be printed if format was used on printf.
Instead of being printed, the content is stored in dest. If dmax is zero, nothing is written and dest may be a null pointer, however the return value (number of bytes that would be written) is still calculated and returned.
+| [out] | dest | pointer to string that will be written into. |
| [in] | dmax | restricted maximum length of dest |
| [in] | fmt | format-control string. |
| [in] | ap | optional arguments |
| -ESNULLP | when fmt is NULL pointer -ESNULLP when dest is NULL and dmax > 0 -ESZEROL when dmax = 0 and dest is not NULL -ESLEMAX when dmax > RSIZE_MAX_STR -EOVERFLOW when dmax > size of dest -ESNOSPC when return value exceeds dmax unless dmax is zero and dest is NULL -EINVAL when fmt contains n |
| -1 | if an encoding error or a runtime constraint violation in the libc function vsnprintf occured. |
errno.| #define vsnprintf_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | fmt, | +
| + | + | + | ap | +
| + | ) | +_vsnprintf_s_chk(dest,dmax,BOS(dest),fmt,ap) | +
The truncating vsnprintf_s function composes a string with same test that would be printed if format was used on printf.
Instead of being printed, the content is stored in dest. At most dmax characters are written. It is guaranteed that dest will be null-terminated.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vsnprintf call fails, errno is set.| [out] | dest | pointer to string that will be written into. |
| [in] | dmax | restricted maximum length of dest |
| [in] | fmt | format-control string. |
| [in] | ap | optional arguments |
fmt shall not be a null pointer. dest shall not be a null pointer. dmax shall not be zero. dmax shall not be greater than RSIZE_MAX_STR and the size of dest. fmt shall not contain the conversion specifier n. s is a null pointer. (not yet) dest is too small for the formatted text, including the terminating null, then the buffer is truncated and null terminated.| -ESNULLP | when dest/fmt is NULL pointer |
| -ESZEROL | when dmax == 0 |
| -ESLEMAX | when dmax > RSIZE_MAX_STR |
| -EOVERFLOW | when dmax > size of dest |
| -EINVAL | when fmt contains n |
| #define strerror_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | errnum | +
| + | ) | +_strerror_s_chk(dest,dmax,errnum,BOS(dest)) | +
The strerror_s function returns a pointer to the textual description of the system error code errnum, identical to the description that would be printed by perror().
In addition to strerror() it adds the size of the destination array in order to prevent buffer overflow, and it truncates overlong error messages with "...".
No more than dmax-1 bytes are written, the buffer is always null-terminated. If the message had to be truncated to fit the buffer and dmax is greater than 3, then only dmax-4 bytes are written, and the characters "..." are appended before the null terminator. The behavior is undefined if writing to dest occurs past the end of the array, which can happen when the size of the buffer pointed to by dest is less than the number of characters in the error message which in turn is less than dmax.
+| [out] | dest | pointer to a user-provided string buffer |
| [in] | dmax | restricted maximum length of dest |
| [in] | errnum | integer value referring to an error code |
| EOK | on success |
| ESNULLP | when dest is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESLEMIN | when the result would be longer than 4 and dmax < 4 |
| #define strcmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strcmp_s_chk(dest,dmax,src,resultp,BOS(dest),BOS(src)) | +
Compares string src to string dest.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to int result, greater than 0, equal to 0 or less than 0, if the string pointed to by dest is greater than, equal to or less than the string pointed to by src respectively. |
| >0 | when dest greater than src |
| 0 | when strings the same |
| <0 | when dest less than src |
| EOK | when comparison is complete |
| ESUNTERM | when dest or src is unterminated, or dmax is too small. |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strcasecmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strcasecmp_s_chk(dest,dmax,src,resultp,BOS(dest)) | +
Case insensitive string comparison by converting to uppercase prior to the compare.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to int result, greater than 0, equal to 0 or less than 0, if the string pointed to by dest is greater than, equal to or less than the string pointed to by src respectively. |
| >0 | when dest greater than src |
| 0 | when strings the same |
| <0 | when dest less than src |
| EOK | when comparison is complete |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define strnatcmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strnatcmp_s_chk(dest,dmax,src,0,resultp,BOS(dest),BOS(src)) | +
Natural order comparison of strings.
+The longest run of numbers wins over alpha chars.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to int result, greater than 0, equal to 0 or less than 0, if the string pointed to by dest is greater than, equal to or less than the string pointed to by src respectively. |
| EOK | when comparison is complete |
| ESUNTERM | when dest or src is unterminated, or dmax is too small. |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define strnatcasecmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strnatcasecmp_s_chk(dest,dmax,src,1,resultp,BOS(dest),BOS(src)) | +
| #define strcasestr_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | substring | +
| + | ) | +_strcasestr_s_chk(dest,dmax,src,slen,substring,BOS(dest),BOS(src)) | +
The strcasestr_s() function locates the first occurrence of the substring pointed to by src which would be located in the string pointed to by dest.
+The comparison is case insensitive.
+| [in] | dest | pointer to string to be searched for the substring |
| [in] | dmax | restricted maximum length of dest string |
| [in] | src | pointer to the substring |
| [in] | slen | maximum length of src string |
| [out] | substring | returned pointer to the substring |
| EOK | when successful operation, substring found. |
| ESNULLP | when dst/src/substring is NULL pointer |
| ESZEROL | when dmax/slen = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_STR |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOTFND | when substring not found |
| #define strcmpfld_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strcmpfld_s_chk(dest,dmax,src,resultp,BOS(dest)) | +
Compares the character array pointed to by src to the character array pointed to by dest for dmax characters.
+The null terminator does not stop the comparison.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to int result. greater than 0, equal to 0 or less than 0, if the string pointed to by dest is greater than, equal to or less than the string pointed to by src respectively. |
| >0 | when dest greater than src |
| 0 | when the strings are the same |
| <0 | when dest less than src |
| EOK | when comparison is complete |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define strcpyfld_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_strcpyfld_s_chk(dest,dmax,src,slen,BOS(dest)) | +
| #define strcpyfldin_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_strcpyfldin_s_chk(dest,dmax,src,slen,BOS(dest)) | +
| #define strcpyfldout_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_strcpyfldout_s_chk(dest,dmax,src,slen,BOS(dest)) | +
| #define strcspn_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | countp | +
| + | ) | +_strcspn_s_chk(dest,dmax,src,slen,countp,BOS(dest),BOS(src)) | +
This function computes the prefix length of the string pointed to by dest which consists entirely of characters that are excluded from the string pointed to by src.
+The scanning stops at the first null in dest or after dmax characters. The exclusion string is checked to the null or after slen characters.
+| [in] | dest | pointer to string to determine the prefix |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to exclusion string |
| [in] | slen | restricted maximum length of string src |
| [out] | countp | pointer to a count variable that will be updated with the dest substring length |
| EOK | when operation is successful |
| ESNULLP | when dest/src/count is NULL pointer |
| ESZEROL | when dmax/slen = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strfirstchar_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | c, | +
| + | + | + | firstp | +
| + | ) | +_strfirstchar_s_chk(dest,dmax,c,firstp,BOS(dest)) | +
This function returns a pointer to the first occurrence of character c in dest.
+The scanning stops at the first null or after dmax characters.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string |
| [in] | c | character to locate |
| [out] | firstp | returned pointer to first occurrence of c |
| EOK | when pointer to first occurrence is returned |
| ESNULLP | when dest/firstp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strfirstdiff_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strfirstdiff_s_chk(dest,dmax,src,resultp,BOS(dest)) | +
Returns the index of the first character that is different between dest and src.
+Index is valid only for OK. The scanning stops at the first null in dest or src, or after dmax characters.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to returned index to first difference |
| EOK | when index to first diff is returned in resultp |
| ESNODIFF | when no difference |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strisalphanumeric_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strisalphanumeric_s_chk(dest,dmax,BOS(dest)) | +
This function checks if the entire string contains alphanumerics.
+The scanning stops at the first null or after smax characters.
+| dest | pointer to string |
| dmax | maximum length of string |
| #define strisascii_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strisascii_s_chk(dest,dmax,BOS(dest)) | +
This function checks if the entire string contains ascii characters.
+The scanning stops at the first null or at most dmax characters.
+| dest | pointer to string |
| dmax | maximum length of string |
| #define strisdigit_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strisdigit_s_chk(dest,dmax,BOS(dest)) | +
This function checks that the entire string contains digits.
+The scanning stops at the first null or after dmax characters.
+| dest | pointer to string |
| dmax | maximum length of string |
| #define strishex_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strishex_s_chk(dest,dmax,BOS(dest)) | +
This function checks that the entire string contains hex characters.
+The scanning stops at the first null or after dmax characters.
+| dest | pointer to string |
| dmax | maximum length of string |
| #define strislowercase_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strislowercase_s_chk(dest,dmax,BOS(dest)) | +
This function checks if entire string is lowercase.
+The scanning stops at the first null or after dmax characters.
+| dest | pointer to string |
| dmax | maximum length of string |
| #define strismixedcase_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strismixedcase_s_chk(dest,dmax,BOS(dest)) | +
This function checks that the entire string is mixed case.
+The scanning stops at the first null or after dmax characters.
+| dest | pointer to string |
| dmax | maximum length of string |
| #define strispassword_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strispassword_s_chk(dest,dmax,BOS(dest)) | +
This function validates the make-up of a password string.
+-Password must have mininmum SAFE_STR_PASSWORD_MIN_LENGTH characters
+ -Password can have maximum SAFE_STR_PASSWORD_MAX_LENGTH characters
+ -Password must have at least SAFE_STR_MIN_LOWERCASE lower case characters
+ -Password must have at least SAFE_STR_MIN_UPPERCASE upper case characters
+ -Password must have at least SAFE_STR_MIN_NUMBERS numbers
+ -Password must have at least SAFE_STR_MIN_SPECIALS special characters
| dest | pointer to string |
| dmax | maximum length of password string |
| #define strisuppercase_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strisuppercase_s_chk(dest,dmax,BOS(dest)) | +
This function checks if entire string is uppercase The scanning stops at the first null or after dmax characters.
+| dest | pointer to string |
| dmax | maximum length of string |
| #define strlastchar_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | c, | +
| + | + | + | lastp | +
| + | ) | +_strlastchar_s_chk(dest,dmax,c,lastp,BOS(dest)) | +
Returns a pointer to the last occurrence of character c in dest.
+The scanning stops at null or after dmax characters.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string |
| [in] | c | character to locate |
| [out] | lastp | returned pointer to last occurrence of c |
| EOK | when pointer to last occurrence is returned |
| ESNULLP | when dst/first is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define strlastdiff_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strlastdiff_s_chk(dest,dmax,src,resultp,BOS(dest)) | +
Returns the index of the last character that is different between dest and src.
+Index is valid only for EOK. The scanning stops at the first null in dest or src, or after dmax characters.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to returned index to last difference |
| EOK | when index to last diff is returned in resultp |
| ESNODIFF | when no difference |
| ESNULLP | when dest/src/idx is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strljustify_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strljustify_s_chk(dest,dmax,BOS(dest)) | +
Removes beginning whitespace from the string pointed to by dest by shifting the text left over writting the beginning whitespace, left justifying the text.
+The left justified text is null terminated. The text is shifted so the original pointer can continue to be used.
+| [out] | dest | pointer to string to left justify |
| [in] | dmax | restricted maximum length of string |
| EOK | when successful operation |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESUNTERM | when dest was not null terminated |
| #define strnterminate_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strnterminate_s_chk(dest,dmax,BOS(dest)) | +
The strnterminate_s function will terminate the string if a null is not encountered before dmax characters.
+| dest | pointer to string |
| dmax | maximum length of string |
| #define strpbrk_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | firstp | +
| + | ) | +_strpbrk_s_chk(dest,dmax,src,slen,firstp,BOS(dest),BOS(src)) | +
Returns a pointer, first, to the first ocurrence of any character in src which is contained in dest.
+| dest | pointer to string to compare against |
| dmax | restricted maximum length of string dest |
| src | pointer to the string |
| slen | restricted length of string src |
| firstp | returned pointer to first occurence |
| EOK | when successful operation |
| ESNULLP | when dest/src/firstp is NULL pointer |
| ESZEROL | when dmax/slen = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strfirstsame_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strfirstsame_s_chk(dest,dmax,src,resultp,BOS(dest)) | +
Returns the index of the first character that is the same between dest and src.
+The scanning stops at the first null in dest or src, or after dmax characters.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to returned index |
| EOK | when index to first same char is returned |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESNOTFND | when not found |
| #define strlastsame_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strlastsame_s_chk(dest,dmax,src,resultp,BOS(dest)) | +
Returns the index of the last character that is the same between dest and src.
+The scanning stops at the first nul in dest or src, or after dmax characters.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to returned index |
| EOK | when index to last same char is returned |
| ESNULLP | when dst/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESNOTFND | when not found |
| #define strprefix_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src | +
| + | ) | +_strprefix_s_chk(dest,dmax,src,BOS(dest)) | +
Determines if the prefix pointed to by src is at the beginning of string pointed to by dest.
+The prefix must be a complete match in dest. Useful for command or user input parsing. The scanning stops at the first null in dest or src, or after dmax characters.
+| dest | pointer to string to compare against |
| dmax | restricted maximum length of dest |
| src | pointer to the prefix |
| EOK | when successful operation, substring found. |
| ESNULLP | when dest/src is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOTFND | when prefix not found in dest |
| #define strremovews_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strremovews_s_chk(dest,dmax,BOS(dest)) | +
Removes beginning and trailing whitespace from the string pointed to by dest by shifting the text left over writting the beginning whitespace (space or tab).
+The shifted-trimmed text is null terminated. The text is shifted so the original pointer can continue to be used. This is useful when the memory was malloc'ed and will need to be freed.
+| [out] | dest | pointer to string to left justify |
| [in] | dmax | restricted maximum length of string |
| EOK | when successful operation |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESUNTERM | when dest was not null terminated |
| #define strspn_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | countp | +
| + | ) | +_strspn_s_chk(dest,dmax,src,slen,countp,BOS(dest),BOS(src)) | +
This function computes the prefix length of the string pointed to by dest which consists entirely of characters that are included from the string pointed to by src.
+| [in] | dest | pointer to string to determine the prefix |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to exclusion string |
| [in] | slen | restricted maximum length of string src |
| [out] | countp | pointer to a count variable that will be updated with the dest substring length |
| EOK | when successful operation, substring found. |
| ESNULLP | when dest/src/countp is NULL pointer |
| ESZEROL | when dmax/slen = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_STR |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strstr_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | substringp | +
| + | ) | +_strstr_s_chk(dest,dmax,src,slen,substringp,BOS(dest),BOS(src)) | +
The strstr_s() function locates the first occurrence of the substring pointed to by src which would be located in the string pointed to by dest.
+| [in] | dest | pointer to string to be searched for the substring |
| [in] | dmax | restricted maximum length of dest string |
| [in] | src | pointer to the sub string |
| [in] | slen | the maximum number of characters to use from src |
| [out] | substringp | the returned substring pointer |
| EOK | when successful operation, substring found. |
| ESNULLP | when dest/src/substring is NULL pointer |
| ESZEROL | when dmax/slen = 0, unless *src = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_STR |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESNOTFND | when substring not found |
| #define strchr_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | ch, | +
| + | + | + | resultp | +
| + | ) | +_strchr_s_chk(dest,dmax,ch,resultp,BOS(dest)) | +
Finds the first occurrence of ch (after conversion to char as if by (char)ch) in the null-terminated byte string pointed to by dest (each character interpreted as unsigned char).
+The terminating null character is considered to be a part of the string and can be found when searching for '\0'.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of dest |
| [in] | ch | character to search for |
| [out] | resultp | pointer to char* in dest |
| EOK | when successfully character found. |
| ESNULLP | when dest/resultp is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESLEMAX | when ch > 255 |
| ESNOTFND | when ch not found in dest |
| #define strrchr_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | ch, | +
| + | + | + | resultp | +
| + | ) | +_strrchr_s_chk(dest,dmax,ch,resultp,BOS(dest)) | +
Finds the last occurrence of ch (after conversion to char as if by (char)ch) in the null-terminated byte string pointed to by dest (each character interpreted as unsigned char).
+The terminating null character is considered to be a part of the string and can be found when searching for '\0'. Unlike strrchr() it honors dmax as maximal string length.
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of dest |
| [in] | ch | character to search for |
| [out] | resultp | pointer to char* in dest |
| EOK | when successfully character found. |
| ESNULLP | when dest/resultp is a NULL pointer |
| ESZEROL | when dmax = 0 or strnlen_s = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESLEMAX | when ch > 255 |
| ESNOTFND | when ch not found in dest |
| #define strtolowercase_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strtolowercase_s_chk(dest,dmax,BOS(dest)) | +
Converts all uppercase characters to lowercase, leaving all other characters unchanged.
+The conversion stops at the first null or after dmax characters.
+| [out] | dest | pointer to string |
| [in] | dmax | maximum length of string |
| EOK | when successful operation |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strtouppercase_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strtouppercase_s_chk(dest,dmax,BOS(dest)) | +
Converts all lowercase characters to uppercase, leaving all other characters unchanged.
+The conversion stops at the first null or after dmax characters.
+| [out] | dest | pointer to string |
| [in] | dmax | maximum length of string |
| EOK | when successful operation |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
ALSO SEE strtolowercase_s()
+ +| #define strlwr_s | +( | ++ | str, | +
| + | + | + | slen | +
| + | ) | +strtolowercase_s((str), (slen)) | +
| #define strupr_s | +( | ++ | str, | +
| + | + | + | slen | +
| + | ) | +strtouppercase_s((str), (slen)) | +
| #define strzero_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_strzero_s_chk(dest,dmax,BOS(dest)) | +
Nulls maximal dmax characters of dest.
+This function can be used to clear strings that contained sensitive data, until the terminating 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.
+| [out] | dest | pointer to string that will be nulled. |
| [in] | dmax | restricted maximum length of dest |
| EOK | when successful operation |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strcoll_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | resultp | +
| + | ) | +_strcoll_s_chk(dest,dmax,src,resultp,BOS(dest)) | +
Compares two null-terminated byte strings according to the current locale as defined by the LC_COLLATE category.
Collation order is the dictionary order: the position of the letter in the national alphabet (its equivalence class) has higher priority than its case or variant. Within an equivalence class, lowercase characters collate before their uppercase equivalents and locale-specific order may apply to the characters with diacritics. In some locales, groups of characters compare as single collation units. For example, "ch" in Czech follows "h" and precedes "i", and "dzs" in Hungarian follows "dz" and precedes "g".
+| [in] | dest | pointer to string to compare against |
| [in] | dmax | restricted maximum length of string dest |
| [in] | src | pointer to the string to be compared to dest |
| [out] | resultp | pointer to result indicator, greater than 0, equal to 0 or less than 0, if the string pointed to by dest is greater than, equal to or less than the string pointed to by src respectively. |
| >0 | when dest greater than src |
| 0 | when strings the same |
| <0 | when dest less than src |
| EOK | when comparison is complete |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strset_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | value | +
| + | ) | +_strset_s_chk(dest,dmax,value,BOS(dest)) | +
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.
+| [out] | dest | string that will be set. |
| [in] | dmax | restricted maximum length of dest |
| [in] | value | character value to write |
| EOK | when successful |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when value > 255 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| #define strnset_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | value, | +
| + | + | + | n | +
| + | ) | +_strnset_s_chk(dest,dmax,value,n,BOS(dest)) | +
Sets maximal n 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.
+| [out] | dest | string that will be set. |
| [in] | dmax | restricted maximum length of dest |
| [in] | value | character value to write |
| [in] | n | number of characters to be written |
| EOK | when successful |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when value > 255 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESNOSPC | when n > dmax |
| #define mbstowcs_s | +( | ++ | retvalp, | +
| + | + | + | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | len | +
| + | ) | +_mbstowcs_s_chk(retvalp,dest,dmax,src,len,BOS(dest)) | +
| #define mbsrtowcs_s | +( | ++ | retvalp, | +
| + | + | + | dest, | +
| + | + | + | dmax, | +
| + | + | + | srcp, | +
| + | + | + | len, | +
| + | + | + | ps | +
| + | ) | +_mbsrtowcs_s_chk(retvalp,dest,dmax,srcp,len,ps,BOS(dest)) | +
Does not permit the ps parameter (the pointer to the conversion state) to be a null pointer.
The restartable mbsrtowcs_s function converts a null-terminated multibyte character sequence from the current LC_CTYPE locale to wchar, which begins in the conversion state described by *ps, from the array whose first element is pointed to by *srcp to its wide character representation. If dest is not null, converted characters are stored in the successive elements of the wchar_t array pointed to by dest. No more than len wide characters are written to the destination array. Each multibyte character is converted as if by a call to mbrtowc. mbsrtowcs_s clobbers the destination array from the terminating null and until dmax. In extension to mbstowc_s you can re-use the state via ps. With SAFECLIB_STR_NULL_SLACK defined the rest is cleared with 0.
The conversion stops if:
+*srcp is set to NULL and *ps represents the initial shift state.*srcp is set to point at the beginning of the first unconverted multibyte character.len. *srcp is set to point at the beginning of the first unconverted multibyte character. This condition is not checked if dest==NULL.| [out] | retvalp | pointer to a size_t object where the result will be stored |
| [out] | dest | pointer to wide character array where the results will be stored |
| [in] | dmax | restricted maximum length of dest |
| [in] | srcp | pointer to the string that will be copied to dest |
| [in] | len | maximal number of wide characters to be copied to dest |
| [in] | ps | pointer to the conversion state object |
RSIZE_MAX_WSTR (unless dest is null). wcsnlen_s(*srcp, dmax). len. In other libc's len is ignored.mbsrtowcs_s nulls dest. | EOK | on successful conversion. |
| ESNULLP | when retvalp, ps, srcp or *srcp are a NULL pointer |
| ESZEROL | when dmax = 0, unless dest is NULL |
| ESLEMAX | when dmax > RSIZE_MAX_WSTR, unless dest is NULL |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax and dest != NULL |
| ESOVRLP | when *srcp and dest overlap |
| ESNOSPC | when there is no null character in the first dmax multibyte characters in the *srcp array and len is greater than dmax (unless dest is null) |
| #define wcsrtombs_s | +( | ++ | retvalp, | +
| + | + | + | dest, | +
| + | + | + | dmax, | +
| + | + | + | srcp, | +
| + | + | + | len, | +
| + | + | + | ps | +
| + | ) | +_wcsrtombs_s_chk(retvalp,dest,dmax,srcp,len,ps,BOS(dest)) | +
Does not permit the ps parameter (the pointer to the conversion state) to be a null pointer.
The restartable wcsrtombs_s function converts a sequence of wide characters from the array whose first element is pointed to by *srcp to to its narrow multibyte representation from the current LC_CTYPE locale that begins in the conversion state described by *ps. If dest is not null, converted characters are stored in the successive elements of dest. No more than len bytes written to the destination array. Each wide character is converted as if by a call to wcrtomb. wcsrtombs_s clobbers the destination array from the terminating null and until dmax. In extension to wcstombs_s you can re-use the state via ps.
The conversion stops if:
+L'\0' was converted and stored. The bytes stored in this case are the unshift sequence (if necessary) followed by '\0', *srcp is set to NULL and *ps represents the initial shift state.wchar_t was found that does not correspond to a valid character in the current LC_CTYPE locale. *srcp is set to point at the first unconverted wide character.len. *srcp is set to point at the beginning of the first unconverted wide character. This condition is not checked if dst==NULL.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. Also in the error cases for srcp = NULL, *srcp = NULL, ESNOSPC and EILSEQ.
+| [out] | retvalp | pointer to a size_t object where the result will be stored |
| [out] | dest | pointer to character array where the result will be stored |
| [in] | dmax | restricted maximum length of dest |
| [in] | srcp | pointer to the wide string that will be copied to dest |
| [in] | len | maximum number of bytes to be written to dest |
| [in] | ps | pointer to the conversion state object |
RSIZE_MAX_STR (unless dest is null). len. len. In other libc's len is ignored.dest is not a null pointer and dmax is greater than zero and not greater than RSIZE_MAX_STR, then wcsrtombs_s nulls dest. Then the number of bytes excluding terminating zero that were, or would be written to dest, is stored in *retvalp. | EOK | on successful conversion. |
| ESNULLP | when retvalp, ps, srcp or *srcp are a NULL pointer |
| ESZEROL | when dmax = 0, unless dest is NULL |
| ESLEMAX | when dmax > RSIZE_MAX_STR, unless dest is NULL |
| EOVERFLOW | when dmax or len > size of dest (optionally, when the compiler knows the object_size statically), unless dest is NULL |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESOVRLP | when *srcp and dest overlap |
| ESNOSPC | when there is no null character in the first dmax multibyte characters in the *srcp array and len is greater than dmax (unless dest is null) |
| EILSEQ | if returned by wctomb() |
| #define wcstombs_s | +( | ++ | retvalp, | +
| + | + | + | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | len | +
| + | ) | +_wcstombs_s_chk(retvalp,dest,dmax,src,len,BOS(dest)) | +
The wcstombs_s function converts a sequence of wide characters from the array whose first element is pointed to by src to to its narrow multibyte representation from the current LC_CTYPE locale.
If dest is not null, converted characters are stored in the successive elements of dest. No more than len bytes are written to the destination array. Each wide character is converted as if by a call to wcrtomb. wcstombs_s clobbers the destination array from the terminating null and until dmax.
The conversion stops if:
+L'\0' was converted and stored. The bytes stored in this case are the unshift sequence (if necessary) followed by '\0'.wchar_t was found that does not correspond to a valid character in the current LC_CTYPE locale.len. This condition is not checked if dest==NULL.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. Also in the error cases for src = NULL, ESNOSPC and EILSEQ.
+| [out] | retvalp | the number of characters converted |
| [out] | dest | buffer for the resulting converted multibyte character string |
| [in] | dmax | The size in bytes of dest |
| [in] | src | wide string that will be converted to dest |
| [in] | len | number of bytes to be stored in dest, not including the terminating null character. |
retvalp and src shall not be a null pointer. RSIZE_MAX_STR (unless dest is null). dmax shall not equal zero (unless dest is null). dmax shall be greater than len. dest is not a null pointer and dmax is greater than zero and not greater than RSIZE_MAX_STR, then wcstombs_s nulls dest. Then the number of bytes excluding terminating zero that were, or would be written to dest, is stored in *retvalp. | EOK | on successful conversion. |
| ESNULLP | when retvalp or src are a NULL pointer |
| ESZEROL | when dmax = 0, unless dest is NULL |
| ESLEMAX | when dmax > RSIZE_MAX_STR, unless dest is NULL |
| EOVERFLOW | when dmax or len > size of dest (optionally, when the compiler knows the object_size statically), unless dest is NULL |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESOVRLP | when src and dest overlap |
| ESNOSPC | when there is no null character in the first dmax multibyte characters in the src array and len is greater than dmax (unless dest is null) |
| EILSEQ | if returned by wcstombs() |
| #define wcrtomb_s | +( | ++ | retvalp, | +
| + | + | + | dest, | +
| + | + | + | dmax, | +
| + | + | + | wc, | +
| + | + | + | ps | +
| + | ) | +_wcrtomb_s_chk(retvalp,dest,dmax,wc,ps,BOS(dest)) | +
Does not permit the ps parameter (the pointer to the conversion state) to be a null pointer.
The restartable wcrtomb_s function converts a single wide character to its narrow multibyte representation from the current LC_CTYPE locale that begins in the conversion state described by *ps. If dest is not null, the converted multibyte characters are stored in dest. Max. MB_CUR_MAX will be written to dest.
If dest is a null pointer, the call is equivalent to wcrtomb_s(&retval, buf, sizeof buf, L'\0', ps) with internal variables retval and buf (whose size is greater than MB_CUR_MAX).
If wc is the null wide character L'\0', a null byte is stored, preceded by any shift sequence necessary to restore the initial shift state and the conversion state parameter *ps is updated to represent the initial shift state.
+If the environment macro STDC_ISO_10646 is defined, the values of type wchar_t are the same as the short identifiers of the characters in the Unicode required set (typically UTF-32 encoding); otherwise, it is implementation-defined. In any case, the multibyte character encoding used by this function is specified by the currently active C locale.
+If the environment macro STDC_MB_MIGHT_NEQ_WC is defined, then for members of the basic character set multibyte-character encoding might not equal wide-character encoding (non-ASCII-based systems, such as EBCDIC-based systems, may use Unicode for their wide character encoding and still be conforming). ASCII-based systems with STDC_ISO_10646 defined leave STDC_MB_MIGHT_NEQ_WC undefined.
+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.
+| [out] | retvalp | pointer to a size_t object where the result will be stored |
| [out] | dest | pointer to bytes where the result will be stored |
| [in] | dmax | restricted maximum length of dest |
| [in] | wc | the wide character to convert |
| [in] | ps | pointer to the conversion state object |
RSIZE_MAX_STR and size of dest (unless dest is null). dest[0] is set to '\0' (unless dest is null or dmax is invalid) and *retvalp is set to (size_t)-1 (unless retvalp is null).| EOK | on successful conversion. |
| ESNULLP | when retvalp or ps are a NULL pointer |
| ESZEROL | when dmax = 0, unless dest is NULL |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically), unless dest is NULL |
| ESLEMAX | when dmax > RSIZE_MAX_STR, unless dest is NULL |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax and dest != NULL |
| ESNOSPC | when dmax is smaller than the number of required bytes |
| #define wctomb_s | +( | ++ | retvalp, | +
| + | + | + | dest, | +
| + | + | + | dmax, | +
| + | + | + | wc | +
| + | ) | +_wctomb_s_chk(retvalp,dest,dmax,wc,BOS(dest)) | +
The wctomb_s function converts a single wide character to its narrow multibyte representation from the current LC_CTYPE locale.
If dest is not null, the converted multibyte characters are stored in dest. Max. MB_CUR_MAX will be written to dest.
If dest is a null pointer, the call is equivalent to wcrtomb_s(&retval, buf, sizeof buf, L'\0', ps) with internal variables retval and buf (whose size is greater than MB_CUR_MAX).
If the environment macro STDC_ISO_10646 is defined, the values of type wchar_t are the same as the short identifiers of the characters in the Unicode required set (typically UTF-32 encoding); otherwise, it is implementation-defined. In any case, the multibyte character encoding used by this function is specified by the currently active C locale.
+If the environment macro STDC_MB_MIGHT_NEQ_WC is defined, then for members of the basic character set multibyte-character encoding might not equal wide-character encoding (non-ASCII-based systems, such as EBCDIC-based systems, may use Unicode for their wide character encoding and still be conforming). ASCII-based systems with STDC_ISO_10646 defined leave STDC_MB_MIGHT_NEQ_WC undefined.
+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. Also in the error cases for ESNOSPC and EILSEQ.
+| [out] | retvalp | pointer to a size_t object where the result will be stored |
| [out] | dest | pointer to bytes where the result will be stored |
| [in] | dmax | restricted maximum length of dest |
| [in] | wc | the wide character to convert |
RSIZE_MAX_STR and size of dest (unless dest is null). dest[0] is set to '\0' (unless dest is null or dmax is invalid) and *retvalp is set to (size_t)-1 (unless retvalp is null).| EOK | on successful conversion. |
| ESNULLP | when retvalp is a NULL pointer |
| ESZEROL | when dmax = 0, unless dest is NULL |
| ESLEMAX | when dmax > RSIZE_MAX_STR, unless dest is NULL |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOSPC | when dmax is smaller than the number of required bytes |
| EILSEQ | if returned by wctomb() |
| #define wcsnlen_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_wcsnlen_s_chk(dest,dmax,BOS(dest)) | +
The wcsnlen_s function computes the length of the wide string pointed to by dest, providing limited support for non-null terminated strings.
+| dest | pointer to wide string |
| dmax | maximum length of wide string, incl. the final null |
MINGW_HAS_SECURE_API this API is forceinline'd and the native wcsnlen_s with the msvcrt has a different dmax limit: INT_MAX. dest is NULL, then wcsnlen_s returns 0. Otherwise, the wcsnlen_s function returns the number of wide characters that precede the terminating null character. If there is no null character in the first dmax characters of dest then wcsnlen_s returns dmax. At most the first dmax characters of dest are accessed by wcsnlen_s.| #define wcscpy_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src | +
| + | ) | +_wcscpy_s_chk(dest,dmax,src,BOS(dest)) | +
The wcscpy_s function copies the string pointed to by src (including the terminating null character) into the array pointed to by dest.
With SAFECLIB_STR_NULL_SLACK defined all elements following the terminating null character (if any) written by wcscpy_s in the array of dmax characters pointed to by dest are nulled when wcscpy_s returns.
| [out] | dest | pointer to wide string that will be replaced by src. |
| [in] | dmax | restricted maximum length of dest |
| [in] | src | pointer to the wide string that will be copied to dest |
| EOK | when successful operation, the wide characters in src were copied into dest and the result is null terminated. |
| -ESNULLP | when dest or src is a NULL pointer |
| -ESZEROL | when dmax = 0 |
| -ESLEMAX | when dmax > RSIZE_MAX_WSTR |
| -ESOVRLP | when buffers overlap |
| -ESNOSPC | when dest < src |
| #define wcsncpy_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_wcsncpy_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
The wcsncpy_s function copies the wide string pointed to by src (including the terminating null character) into the wide string pointed to by dest.
+With SAFECLIB_STR_NULL_SLACK defined all elements following the terminating null character (if any) written by wcsncpy_s in the array of dmax characters pointed to by dest are nulled when wcsncpy_s returns.
+| [out] | dest | pointer to wide string that will be replaced by src. |
| [in] | dmax | restricted maximum length of dest |
| [in] | src | pointer to the wide string that will be copied to dest |
| [in] | slen | maximum number of wide characters to copy |
| EOK | successful operation, when slen == 0 or the wide characters in src were copied into dest and the result is null terminated. |
| ESNULLP | when dest/src is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESOVRLP | when buffers overlap |
| ESNOSPC | when src > dest |
| #define wcscat_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src | +
| + | ) | +_wcscat_s_chk(dest,dmax,src,BOS(dest)) | +
The wcscat_s function appends a copy of the wide string pointed to by src (including the terminating null character) to the end of the wide string pointed to by dest.
+The initial wide character from src overwrites the null character at the end of dest.
+All elements following the terminating null wide character (if any) written by wcscat_s in the array of dmax characters pointed to by dest take unspecified values when wcscat_s returns. With SAFECLIB_STR_NULL_SLACK defined the rest is cleared with 0.
+| [out] | dest | pointer to wide string that will be extended by src if dmax allows. The wide string is null terminated. If the resulting concatenated wide string is less than dmax, the remaining slack space is nulled. |
| [in] | dmax | restricted maximum wchar_t length of the resulting dest, including the null |
| [in] | src | pointer to the wide string that will be concatenaed to string dest |
| EOK | when successful operation, all the wide characters from src were appended to dest and the result in dest is null terminated. |
| ESNULLP | when dest or src is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESUNTERM | when dest not terminated in the first dmax wide characters |
| ESOVRLP | when src overlaps with dest |
| #define wcsncat_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen | +
| + | ) | +_wcsncat_s_chk(dest,dmax,src,slen,BOS(dest),BOS(src)) | +
The wcsncat_s function appends a copy of the wide string pointed to by src (including the terminating null wide character) to the end of the wide string pointed to by dest.
+The initial character from src overwrites the null wide character at the end of dest.
+All elements following the terminating null wide character (if any) written by wcsncat_s in the array of dmax wide characters pointed to by dest take unspecified values when wcsncat_s returns. With SAFECLIB_STR_NULL_SLACK defined the rest is cleared with 0.
+| [out] | dest | pointer to wide string that will be extended by src if dmax allows. The string is null terminated. If the resulting concatenated wide string is less than dmax, the remaining slack space is nulled. |
| [in] | dmax | restricted maximum length of the resulting dest, including the null |
| [in] | src | pointer to the wide string that will be concatenaed to string dest |
| [in] | slen | maximum wide characters to append |
| EOK | successful operation, when slen == 0 or all the wide characters are copied from src and dest is null terminated. As special case, analog to msvcrt: when slen == 0 and dmax is big enough for dest, also return EOK, but clear dest. |
| ESNULLP | when dest/src is NULL pointer and slen > 0 |
| ESZEROL | when dmax = 0 and slen > 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_WSTR and slen > 0 |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESUNTERM | when dest not terminated and slen > 0 |
| ESOVRLP | when src overlaps with dest and slen > 0 |
| #define wcstok_s | +( | ++ | dest, | +
| + | + | + | dmaxp, | +
| + | + | + | delim, | +
| + | + | + | ptr | +
| + | ) | +_wcstok_s_chk(dest,dmaxp,delim,ptr,BOS(dest)) | +
A sequence of calls to the wcstok_s function breaks the string pointed to by dest into a sequence of tokens, each of which is delimited by a character from the string pointed to by delim.
+The fourth argument points to a caller-provided char pointer into which the wcstok_s function stores information necessary for it to continue scanning the same string.
+The first call in a sequence has a non-null first argument and dmax points to an object whose value is the number of elements in the character array pointed to by the first argument. The first call stores an initial value in the object pointed to by ptr and updates the value pointed to by dmax to reflect the number of elements that remain in relation to ptr. Subsequent calls in the sequence have a null first argument and the objects pointed to by dmax and ptr are required to have the values stored by the previous call in the sequence, which are then updated. The separator string pointed to by delim may be different from call to call.
+The first call in the sequence searches the string pointed to by dest for the first character that is not contained in the current separator string pointed to by delim. If no such character is found, then there are no tokens in the string pointed to by dest and the wcstok_s function returns a null pointer. If such a character is found, it is the start of the first token.
+The wcstok_s function then searches from there for the first character in dest that is contained in the current separator string. If no such character is found, the current token extends to the end of the string pointed to by dest, and subsequent searches in the same string for a token return a null pointer. If such a character is found, it is overwritten by a null character, which terminates the current token.
+In all cases, the wcstok_s function stores sufficient information in the pointer pointed to by ptr so that subsequent calls, with a null pointer for dest and the unmodified pointer value for ptr, shall start searching just past the element overwritten by a null character (if any).
+delim uses a STRTOK_DELIM_MAX_LEN of 16.
+| [in] | dest | pointer to wide string to tokenize |
| [out] | dmaxp | pointer to the restricted maximum length of dest |
| [in] | delim | pointer to wide delimiter string (len < 255) |
| [out] | ptr | returned pointer to token |
wchar_t* wcstok_s(wchar_t *str, const wchar_t *delim, wchar_t **next_token)errno is set to: ESNULLP when dest/delim/ptr is NULL pointer ESZEROL when *dmax = 0 ESLEMAX when *dmax > RSIZE_MAX_WSTR EOVERFLOW when *dmax > size of dest if dest != NULL ESUNTERM when unterminated string C11 just returns EINVAL
+| #define vswprintf_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | fmt, | +
| + | + | + | ap | +
| + | ) | +_vswprintf_s_chk(dest,dmax,BOS(dest),fmt,ap) | +
| #define vsnwprintf_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | fmt, | +
| + | + | + | ap | +
| + | ) | +_vsnwprintf_s_chk(dest,dmax,BOS(dest),fmt,ap) | +
The truncating vsnwprintf_s function composes a wide string with same test that would be printed if format was used on wprintf.
Instead of being printed, the content is stored in dest. dest will be terminated with a null character. With SAFECLIB_STR_NULL_SLACK defined all elements following the terminating null character (if any) written by vsnwprintf_s in the array of dmax wide characters pointed to by dest are nulled when vsnwprintf_s returns.
errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vswprintf or vsnwprintf call fails, errno is set.| [out] | dest | pointer to wide string that will be written into. |
| [in] | dmax | restricted maximum length of dest |
| [in] | fmt | format-control wide string. |
| [in] | ap | optional arguments |
snprintf, which makes it possible to determine the required output buffer size, there is no equivalent for wide strings (until C11's snwprintf_s), and in order to determine the buffer size, the program may need to call swprintf, check the result value, and reallocate a larger buffer, trying again until successful.snwprintf_s, unlike swprintf_s, will truncate the result to fit within the array pointed to by buffer, even though truncation is treated as an error by most bounds-checked functions.vsnwprintf, vswprintf_s guarantees that the buffer will be null-terminated unless the buffer size is zero.| -ESNULLP | when dest/fmt is NULL pointer |
| -ESZEROL | when dmax = 0 |
| -ESLEMAX | when dmax > RSIZE_MAX_WSTR |
| -EOVERFLOW | when dmax > size of dest |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then |
| #define wcsstr_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | slen, | +
| + | + | + | substringp | +
| + | ) | +_wcsstr_s_chk(dest,dmax,src,slen,substringp,BOS(dest),BOS(src)) | +
The wcsstr_s() function locates the first occurrence of the wide substring pointed to by src which would be located in the wide string pointed to by dest.
| [in] | dest | wide string to be searched for the substring |
| [in] | dmax | restricted maximum length of dest |
| [in] | src | pointer to the wide sub string |
| [in] | slen | the maximum number of wide characters to use from src |
| [out] | substringp | the returned substring pointer |
| EOK | when successful operation, substring found. |
| ESNULLP | when dest/src/substringp is NULL pointer |
| ESZEROL | when dmax/slen = 0 |
| ESLEMAX | when dmax/slen > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax/slen > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOTFND | when substring not found |
| #define wcscmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | smax, | +
| + | + | + | resultp | +
| + | ) | +_wcscmp_s_chk(dest,dmax,src,smax,resultp,BOS(dest),BOS(src)) | +
Compares wide string src to wide string dest.
+| [in] | dest | wide string to compare against |
| [in] | dmax | restricted maximum length of wide string dest |
| [in] | src | wide string to be compared to dest |
| [in] | smax | restricted maximum length of wide string src |
| [out] | resultp | pointer to result diff, greater than 0, equal to 0 or less than 0, if the dest is greater than, equal to or less than src respectively. |
| EOK | when comparison is complete |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax/smax = 0 |
| ESLEMAX | when dmax/smax > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax/smax > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define wcsncmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | smax, | +
| + | + | + | count, | +
| + | + | + | resultp | +
| + | ) | +_wcsncmp_s_chk(dest,dmax,src,smax,count,resultp,BOS(dest),BOS(src)) | +
Compares at most count wide characters of wide string src with wide string dest, and returns if difference in the last parameter.
+| [in] | dest | wide string to compare against |
| [in] | dmax | restricted maximum length of wide string dest |
| [in] | src | wide string to be compared to dest |
| [in] | smax | restricted maximum length of wide string src |
| [in] | count | maximum number of wide characters to compare |
| [out] | resultp | pointer to result diff, greater than 0, equal to 0 or less than 0, if the dest is greater than, equal to or less than src respectively. |
| EOK | when comparison is complete |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax/smax = 0 |
| ESLEMAX | when dmax/smax > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax/smax > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define wcsicmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | smax, | +
| + | + | + | resultp | +
| + | ) | +_wcsicmp_s_chk(dest,dmax,src,smax,resultp,BOS(dest),BOS(src)) | +
Compares two wide strings case-folded, via wcsfc_s(), i.e.
case-folded and normalized, and returns if difference in the last parameter. The two strings may overlap.
+| [in] | dest | wide string to compare against |
| [in] | dmax | restricted maximum length of wide string dest |
| [in] | src | wide string to be compared to dest |
| [in] | smax | restricted maximum length of wide string src |
| [out] | resultp | pointer to result diff, greater than 0, equal to 0 or less than 0, if the dest is greater than, equal to or less than src respectively. |
| EOK | when comparison is complete |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax/smax = 0 |
| ESLEMAX | when dmax/smax > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax/smax > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define wcsnatcmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | smax, | +
| + | + | + | resultp | +
| + | ) | +_wcsnatcmp_s_chk(dest,dmax,src,smax,0,resultp,BOS(dest),BOS(src)) | +
| #define wcsnaticmp_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | smax, | +
| + | + | + | resultp | +
| + | ) | +_wcsnatcmp_s_chk(dest,dmax,src,smax,1,resultp,BOS(dest),BOS(src)) | +
Natural order comparison of strings.
+The longest run of numbers wins over alpha chars.
+| [in] | dest | pointer to wide string to compare against |
| [in] | dmax | restricted maximum length of wide string dest |
| [in] | src | pointer to the wide string to be compared to dest |
| [in] | smax | restricted maximum length of wide string src |
| [out] | resultp | pointer to int result, greater than 0, equal to 0 or less than 0, if the string pointed to by dest is greater than, equal to or less than the string pointed to by src respectively. |
| EOK | when comparison is complete |
| ESUNTERM | when dest or src is unterminated, or dmax is too small. |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESZEROL | when dmax/smax = 0 |
| ESLEMAX | when dmax/smax > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax/smax > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define wcsset_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | value | +
| + | ) | +_wcsset_s_chk(dest,dmax,value,BOS(dest)) | +
Sets maximal dmax wide characters of dest to a wide 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 wide characters pointed to by dest are nulled.
+| [out] | dest | wide string that will be set. |
| [in] | dmax | restricted maximum length of dest |
| [in] | value | wide character value to write |
| EOK | when successful |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_WSTR or value > _UNICODE_MAX |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define wcsnset_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | value, | +
| + | + | + | n | +
| + | ) | +_wcsnset_s_chk(dest,dmax,value,n,BOS(dest)) | +
Sets maximal n wide characters of dest to a wide 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 wide characters pointed to by dest are nulled.
+| [out] | dest | wide string that will be set. |
| [in] | dmax | restricted maximum length of dest |
| [in] | value | wide character value to write |
| [in] | n | number of wide characters to be written |
| EOK | when successful |
| ESNULLP | when dest is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_WSTR or value > _UNICODE_MAX |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOSPC | when n > dmax |
| #define wcscoll_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | smax, | +
| + | + | + | resultp | +
| + | ) | +_wcscoll_s_chk(dest,dmax,src,smax,resultp,BOS(dest),BOS(src)) | +
Compares two null-terminated wide strings according to the current locale as defined by the LC_COLLATE category.
Collation order is the dictionary order: the position of the letter in the national alphabet (its equivalence class) has higher priority than its case or variant. Within an equivalence class, lowercase characters collate before their uppercase equivalents and locale-specific order may apply to the characters with diacritics. In some locales, groups of characters compare as single collation units. For example, "ch" in Czech follows "h" and precedes "i", and "dzs" in Hungarian follows "dz" and precedes "g".
+| [in] | dest | wide string to compare against |
| [in] | dmax | restricted maximum length of dest |
| [in] | src | wide string to be compared to dest |
| [in] | smax | restricted maximum length of src |
| [out] | resultp | pointer to result indicator, greater than 0, equal to 0 or less than 0, if the string pointed to by dest is greater than, equal to or less than the string pointed to by src respectively. |
| EOK | when comparison is complete |
| ESNULLP | when dest/src/resultp is NULL pointer |
| ESZEROL | when dmax/smax = 0 |
| ESLEMAX | when dmax/smax > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax/smax > size of dest/src (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| #define wcslwr_s | +( | ++ | src, | +
| + | + | + | slen | +
| + | ) | +_wcslwr_s_chk(src,slen,BOS(src)) | +
Scans the string converting uppercase characters to simple lowercase, leaving all other characters unchanged.
+The scanning stops at the first null or after slen characters. The conversion is determined by the LC_CTYPE category setting of the locale. Other characters are not affected. It only performs simple case folding via towlower(), it does not do full multi-char folding and does not obey the special casing rules for context. See wcsfc_s() instead. Thus the length of buffer stays the same. It returns a pointer to the altered string. Because the modification is done in place, the pointer returned is the same as the pointer passed as the input argument.
| [out] | src | wide string |
| [in] | slen | maximum length of string |
| EOK | on successful operation or slen = 0 |
| ESNULLP | when src is NULL pointer |
| ESLEMAX | when slen > RSIZE_MAX_WSTR |
| EOVERFLOW | when slen > size of src (optionally, when the compiler knows the object_size statically) |
| #define wcsupr_s | +( | ++ | src, | +
| + | + | + | slen | +
| + | ) | +_wcsupr_s_chk(src,slen,BOS(src)) | +
Scans the string converting lowercase characters to uppercase, leaving all other characters unchanged.
+The scanning stops at the first null or after slen characters. The conversion is determined by the LC_CTYPE category setting of the locale. Other characters are not affected. It converts only single chars via towupper(). It returns a pointer to the altered string. Because the modification is done in place, the pointer returned is the same as the pointer passed as the input argument.
| [out] | src | wide string |
| [in] | slen | maximum length of string |
| EOK | on successful operation or slen = 0 |
| ESNULLP | when src is NULL pointer |
| ESLEMAX | when slen > RSIZE_MAX_WSTR |
| EOVERFLOW | when slen > size of src (optionally, when the compiler knows the object_size statically) |
| #define towfc_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src | +
| + | ) | +_towfc_s_chk(dest,dmax,src,BOS(dest)) | +
towfc_s() converts a wide character to fully fold-cased (lowercased with possible expansions), according to the Unicode 10.0 CaseFolding table.
Even in most the unsuccessul cases, just not with with ESNULLP and ESZEROL dest is being written to.
+As of Unicode 10.0 there are no possible results as surrogate pairs with sizeof(wchar_t)==2, all results are below U+10000.
| [out] | dest | wide string buffer to store result |
| [in] | dmax | maximum size of dest, should be 4. (3 + NULL) |
| [in] | src | wide character to convert to lowercase |
| >=0 | on successful operation, returns the number of converted wide characters: 0-3 |
| -ESNULLP | when dest is NULL pointer |
| -ESZEROL | when dmax = 0 |
| -ESLEMIN | when dmax < 4 |
| -ESLEMAX | when dmax > RSIZE_MAX_WSTR |
| -EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| -ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| -ESNOTFND | when no mapping for src was found, iswfc is wrong. |
| #define wcsfc_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | lenp | +
| + | ) | +_wcsfc_s_chk(dest,dmax,src,lenp,BOS(dest)) | +
Converts the wide string via full case-folding NFD normalized to lowercase.
+The conversion stops at the first null or after dmax characters. The conversion is determined by the LC_CTYPE category setting of the locale. Other characters are not affected. fold-case performs full case folding, i.e. if iswfc() of a character > 1, the length of dest might be greater than the length of src (max 4 per char), the conversion is done via towfc_s() and Unicode 10.0, the Unicode special-casing rules are obeyed, and composed characters are normalized to NFD via wcsnorm_decompose_s() and wcsnorm_reorder_s(). If not, the conversion is per character done via normal towlower(). Note that decomposition creates larger strings, typically 2-3 chars more.
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.
+SpecialCasing checks for conditional boundary context at the begin or end of certain characters (final greek sigma), and locale sensitive rules for the Lithuanian and the Turkish/Azeri I-dot.
+Composed characters are checked for the left-hand-side of the Decomposition_Mapping Unicode property, which means the codepoint will be normalized to NFD if any codepoint is composed. Technically only FCD as all FC expansions are already properly ordered, and all mangled marks will not be reordered, as the have the same Combining Class.
+| [out] | dest | wide string to hold the result (~130% larger than src) |
| [in] | dmax | maximum result buffer size |
| [in] | src | wide string |
| [out] | lenp | pointer to length of the result, may be NULL |
| EOK | on successful operation |
| ESNULLP | when dest or src is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_WSTR or a cp > 0x10ffff |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOSPC | when dmax is too small for the decomposition. *lenp is still written, to know how much space is needed. |
| ESNOTFND | Internal error as returned by towfc_s() for multi-char foldings. happens only when the internal implementations of iswfc() and towfc_s() are mismatched. |
| #define wcsnorm_decompose_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | lenp, | +
| + | + | + | iscompat | +
| + | ) | +_wcsnorm_decompose_s_chk(dest,dmax,src,lenp,iscompat,BOS(dest)) | +
Converts the wide string to the canonical NFD normalization, as defined in the latest Unicode standard, latest 10.0.
+The conversion stops at the first null or after dmax characters.
+Composed characters are checked for the left-hand-size of the Decomposition_Mapping Unicode property, which means the codepoint will be normalized if the sequence is composed. This is equivalent to all 1963 combining mark characters, plus some remaining 869 non-mark and non-hangul normalizables. Hangul has some special normalization logic.
+This function is used by wcsnorm_s() to do the argument checking, overlap checking and to do the first of three passes for NFC.
| [out] | dest | wide string to hold the result |
| [in] | dmax | maximum result buffer size |
| [in] | src | wide string |
| [out] | lenp | pointer to length of the result, may be NULL |
| [in] | iscompat | do NFKD, and not NFD (with –enable-norm-compat) |
| EOK | on success |
| ESNULLP | when dest or src is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMIN | when dmax < 5 or 19 with a compat mode |
| ESLEMAX | when dmax > RSIZE_MAX_WSTR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESOVRLP | when buffers overlap |
| ESNOSPC | when dmax too small for the result buffer |
| EOF | on some normalization error |
| #define wcsnorm_reorder_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | len | +
| + | ) | +_wcsnorm_reorder_s_chk(dest,dmax,src,len,BOS(dest)) | +
Reorder all decomposed sequences in a wide string to NFD, as defined in the latest Unicode standard, latest 10.0.
+The conversion stops at the first null or after dmax characters.
+| [out] | dest | wide string to hold the result |
| [in] | dmax | maximum result buffer size |
| [in] | src | wide string to be converted |
| [in] | len | length of src |
wcsnorm_reorder_s nulls dest. | EOK | on success |
| ESNOSPC | when dmax too small for the result buffer |
| EOF | on some normalization error |
| #define wcsnorm_compose_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | lenp, | +
| + | + | + | iscontig | +
| + | ) | +_wcsnorm_compose_s_chk(dest,dmax,src,lenp,iscontig,BOS(dest)) | +
Combine all decomposed sequences in a wide string to NFC, as defined in the latest Unicode standard, latest 10.0.
+The conversion stops at the first null or after dmax characters.
+| [out] | dest | wide string to hold the result |
| [in] | dmax | maximum result buffer size |
| [in] | src | wide string to be converted |
| [out] | lenp | pointer to length of p and the result length. |
| [in] | iscontig | if true, the result will only be a fast FCC |
wcsnorm_reorder_s nulls dest. | EOK | on success |
| ESNOSPC | when dmax too small for the result buffer |
| EOF | on some normalization error |
| #define wcsnorm_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | src, | +
| + | + | + | mode, | +
| + | + | + | lenp | +
| + | ) | +_wcsnorm_s_chk(dest,dmax,src,mode,lenp,BOS(dest)) | +
Converts the wide string to the canonical NFC or NFD normalization, as defined in the latest Unicode standard, latest 10.0.
+The conversion stops at the first null or after dmax characters.
+Decomposed characters are checked for the left-hand-size and then right-hand-side of the Decomposition_Mapping Unicode property, which means the codepoint will be normalized if the sequence is composed or decomposed (NFD or NFKD). This is equivalent to all 1963 combining mark characters, plus some remaining 869 non-mark and non-hangul normalizables. Hangul has some special normalization logic.
+The compat tables for NFKC or NFKD are too large for a libc, and mostly unused. As default we only provide the smaller canonical conversions, but it can be enabled with –enable-norm-compat. The compat modes also don't roundtrip.
| [out] | dest | wide string to hold the result |
| [in] | dmax | maximum length of string |
| [in] | src | wide string |
| [in] | mode | convert to nfc or just nfd. experimentally to fast modes FCD or FCC. optionally to compat modes NFKD, NFKC with –enable-norm-compat |
wcsnorm_mode. | [out] | lenp | pointer to length of the result, may be NULL |
| EOK | on success |
| ESNULLP | when dest or src is NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMIN | when dmax < 5 |
| ESLEMAX | when dmax > RSIZE_MAX_WSTR |
| ESOVRLP | when buffers overlap |
| ESNOSPC | when dmax too small for the result buffer |
| EOF | any other normalization error |
| EXTERN void abort_handler_s | +( | +const char *restrict | +msg, | +
| + | + | void *restrict | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
This function writes a message on the standard error stream in an implementation-defined format.
+The message shall include the string pointed to by msg. The abort_handler_s function then calls the abort function.
+| [in] | msg | Pointer to the message describing the error |
| [in] | ptr | Pointer to aassociated data. Can be NULL. |
| [in] | error | The error code encountered. |
| EXTERN void ignore_handler_s | +( | +const char *restrict | +msg, | +
| + | + | void *restrict | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
This function simply returns to the caller.
+| [in] | msg | Pointer to the message describing the error |
| [in] | ptr | Pointer to aassociated data. Can be NULL. |
| [in] | error | The error code encountered. |
| EXTERN constraint_handler_t set_str_constraint_handler_s | +( | +constraint_handler_t | +handler | ) | ++ |
The set_str_constraint_handler_s function sets the runtime-constraint handler to be handler.
+The runtime-constraint handler is the function to be called when a library function detects a runtime-constraint violation. Only the most recent handler registered with set_str_constraint_handler_s is called when a runtime-constraint violation occurs. When the handler is called, it is passed the following arguments in the following order:
| EXTERN errno_t _strcat_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strcpy_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strncat_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | +&& | +
| EXTERN errno_t empty dest or dmax BOS_ATTR | +( | +(slen||dest||dmax) &&_BOS_OVR(dest, dmax) | +, | +
| + | + | "dest overflow" | ++ |
| + | ) | ++ |
| EXTERN errno_t _strncpy_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN rsize_t _strnlen_s_chk | +( | +const char * | +str, | +
| + | + | rsize_t | +smax, | +
| + | + | const size_t | +strbos | +
| + | ) | ++ |
| EXTERN char* _strtok_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t *restrict | +dmaxp, | +
| + | + | const char *restrict | +delim, | +
| + | + | char **restrict | +ptr, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN int sprintf_s | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
| EXTERN int _vsprintf_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
| EXTERN int snprintf_s | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
| EXTERN int _vsnprintf_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
| EXTERN int sscanf_s | +( | +const char *restrict | +buffer, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The sscanf_s function reads a formatted string, and writes to a list of arguments.
Reaching the end of the string is equivalent to reaching the end-of-file condition for fscanf.
| [in] | buffer | pointer to a null-terminated string to read from |
| [in] | fmt | format-control string. |
| [out] | ... | arguments to write to |
buffer nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int fscanf_s | +( | +FILE *restrict | +stream, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The fscanf_s function reads a formatted string from a buffered FILE stream, and writes to a list of arguments.
| [in] | stream | pointer to a FILE stream to read from |
| [in] | fmt | format-control string. |
| [out] | ... | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int scanf_s | +( | +const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The scanf_s function reads a formatted string from stdin, and writes to a list of arguments.
Reaching the end of the io buffer is equivalent to reaching the end-of-file condition for fscanf.
| [in] | fmt | format-control string. |
| [out] | ... | arguments to write to |
fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int vscanf_s | +( | +const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vscanf_s function reads a formatted string from stdin, and writes to a list of arguments.
Reaching the end of the io buffer is equivalent to reaching the end-of-file condition for fscanf.
| [in] | fmt | format-control string. |
| [out] | ap | arguments to write to |
fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int vfscanf_s | +( | +FILE *restrict | +stream, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vfscanf_s function reads a formatted string from a buffered FILE stream, and writes to a list of arguments.
| [in] | stream | pointer to a FILE stream to read from |
| [in] | fmt | format-control string. |
| [out] | ap | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int vsscanf_s | +( | +const char *restrict | +buffer, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vsscanf_s function reads a formatted string, and writes to a list of arguments.
Reaching the end of the string is equivalent to reaching the end-of-file condition for fscanf.
| [in] | buffer | pointer to a null-terminated string to read from |
| [in] | fmt | format-control string. |
| [out] | ap | arguments to write to |
buffer nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int printf_s | +( | +const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The printf_s function composes a string via the format string and writes it to a FILE buffer.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vprintf call fails, errno is set.| [in] | fmt | format-control string |
| [in] | ... | optional arguments |
| -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then. |
| EXTERN int fprintf_s | +( | +FILE *restrict | +stream, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The fprintf_s function composes a string via the format string and writes it to a FILE buffer.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vfprintf call fails, errno is set.| [out] | stream | output file stream to write to |
| [in] | fmt | format-control string. |
| [in] | ... | optional arguments |
| -ESNULLP | when stream/fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then. |
| EXTERN int vprintf_s | +( | +const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vprintf_s function composes a string via the format string and writes it to a FILE buffer.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vprintf call fails, errno is set.| [in] | fmt | format-control string |
| [in] | ap | optional arguments |
| -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then. |
| EXTERN int vfprintf_s | +( | +FILE *restrict | +stream, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vfprintf_s function composes a string via the format string and writes it to a FILE buffer.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vfprintf call fails, errno is set.| [out] | stream | output file stream to write to |
| [in] | fmt | format-control string. |
| [in] | ap | optional arguments |
| -ESNULLP | when stream/fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then. |
| EXTERN errno_t _strerror_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | errno_t | +errnum, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN size_t strerrorlen_s | +( | +errno_t | +errnum | ) | ++ |
The strerrorlen_s function returns the untruncated length of the textual description of the system error code errnum, identical to the description that would be printed by perror().
| [in] | errnum | integer value referring to an error code |
| EXTERN errno_t _strcmp_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _strcasecmp_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strnatcmp_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | const int | +fold_case, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _strcasestr_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | char ** | +substring, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _strcmpfld_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strcpyfld_s_chk | +( | +char * | +dest, | +
| + | + | const rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strcpyfldin_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strcpyfldout_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strcspn_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | rsize_t * | +countp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _strfirstchar_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | char | +c, | +
| + | + | char ** | +firstp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strfirstdiff_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN bool _strisalphanumeric_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN bool _strisascii_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN bool _strisdigit_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN bool _strishex_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN bool _strislowercase_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN bool _strismixedcase_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN bool _strispassword_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN bool _strisuppercase_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strlastchar_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | char | +c, | +
| + | + | char ** | +lastp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strlastdiff_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strljustify_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN rsize_t _strnterminate_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strpbrk_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | char * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | char ** | +firstp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _strfirstsame_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strlastsame_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strprefix_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strremovews_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strspn_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | rsize_t * | +countp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _strstr_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char * | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | char ** | +substringp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _strchr_s_chk | +( | +const char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const int | +ch, | +
| + | + | char **restrict | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strrchr_s_chk | +( | +const char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const int | +ch, | +
| + | + | char **restrict | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strtolowercase_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strtouppercase_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strzero_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strcoll_s_chk | +( | +const char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strset_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | int | +value, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _strnset_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | int | +value, | +
| + | + | rsize_t | +n, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t n VAL_OVR2 | +( | +value | +, | +
| + | + | 255 | ++ |
| + | ) | ++ |
| EXTERN errno_t _mbstowcs_s_chk | +( | +size_t *restrict | +retvalp, | +
| + | + | wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | rsize_t | +len, | +
| + | + | const size_t | +destbos | +
| + | ) | +&& | +
| EXTERN errno_t empty dmax BOS_ATTR | +( | +! | +_BOS_NULLdest) &&_BOSW_OVR(dest, dmax, | +
| + | + | "dest overflow" | ++ |
| + | ) | +&& == *srcp | +
| EXTERN errno_t empty dmax dest overlap BOS_CHK2 | +( | +src | +, | +
| + | + | len | ++ |
| + | ) | ++ |
| EXTERN errno_t _mbsrtowcs_s_chk | +( | +size_t *restrict | +retvalp, | +
| + | + | wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char **restrict | +srcp, | +
| + | + | rsize_t | +len, | +
| + | + | mbstate_t *restrict | +ps, | +
| + | + | const size_t | +destbos | +
| + | ) | +&& | +
| EXTERN errno_t len BOS_ATTR | +( | +dmax && | +len, | +
| + | + | dmax | +, | +
| + | + | "len | +overflow, | +
| + | + | dmax" | ++ |
| + | ) | ++ |
| EXTERN errno_t _wcsrtombs_s_chk | +( | +size_t *restrict | +retvalp, | +
| + | + | char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t **restrict | +srcp, | +
| + | + | rsize_t | +len, | +
| + | + | mbstate_t *restrict | +ps, | +
| + | + | const size_t | +destbos | +
| + | ) | +&& | +
| EXTERN errno_t dest overflow BOS_ATTR | +( | +!_BOS_NULL(dest) &&(void *) | +dest = = (void*)srcp, |
+
| + | + | "dest overlap" | ++ |
| + | ) | +&& | +
| EXTERN errno_t _wcstombs_s_chk | +( | +size_t *restrict | +retvalp, | +
| + | + | char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +len, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _wcrtomb_s_chk | +( | +size_t *restrict | +retvalp, | +
| + | + | char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | wchar_t | +wc, | +
| + | + | mbstate_t *restrict | +ps, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _wctomb_s_chk | +( | +int *restrict | +retvalp, | +
| + | + | char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | wchar_t | +wc, | +
| + | + | const size_t | +destbos | +
| + | ) | +&& | +
| EXTERN errno_t dest overflow or empty VAL_OVR2 | +( | +wc | +, | +
| + | + | 0x10ffff | ++ |
| + | ) | ++ |
| EXTERN size_t _wcsnlen_s_chk | +( | +const wchar_t * | +dest, | +
| + | + | size_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _wcscpy_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _wcsncpy_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wcscat_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _wcsncat_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | +&& | +
| EXTERN errno_t dmax empty dest or dmax BOS_ATTR | +( | +slen && | +_BOSW_OVR(src, slen)||_BOS_NULL(src), | +
| + | + | "src overflow or empty" | ++ |
| + | ) | ++ |
| EXTERN wchar_t* _wcstok_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t *restrict | +dmaxp, | +
| + | + | const wchar_t *restrict | +delim, | +
| + | + | wchar_t **restrict | +ptr, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN int swprintf_s | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
| EXTERN int _vswprintf_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
| EXTERN int snwprintf_s | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
| EXTERN int _vsnwprintf_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
| EXTERN int wprintf_s | +( | +const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The wprintf_s function prints formatted output to stdout as wide string.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vwprintf call fails, errno is set.| [in] | fmt | format-control wide string. |
| [in] | ... | optional arguments |
n s is a null pointer (not yet) | -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | some other error. errno: EINVAL or EOVERFLOW |
| EXTERN int vwprintf_s | +( | +const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vwprintf_s function prints formatted output to stdout as wide string.
+| [in] | fmt | format-control wide string. |
| [in] | ap | optional arguments |
fmt shall not be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer (not yet) | -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | some other error. errno: EINVAL or EOVERFLOW |
| EXTERN int fwprintf_s | +( | +FILE *restrict | +stream, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The fwprintf_s function prints formatted output to a wide stream.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vfwprintf call fails, errno is set.| [in] | stream | output wide stream to write to |
| [in] | fmt | format-control wide string. |
| [in] | ... | optional arguments |
n s is a null pointer (not yet) | -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | some other error. errno: EINVAL or EOVERFLOW |
| EXTERN int vfwprintf_s | +( | +FILE *restrict | +stream, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vfwprintf_s function prints formatted output to a wide stream.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vfwprintf call fails, errno is set.| [in] | stream | output wide stream to write to |
| [in] | fmt | format-control wide string. |
| [in] | ap | optional arguments |
n s is a null pointer (not yet) | -ESNULLP | when stream or fmt is a NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | some other error. errno: EINVAL or EOVERFLOW |
| EXTERN int swscanf_s | +( | +const wchar_t *restrict | +src, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The swscanf_s function reads a formatted wide string.
+Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf.
| [in] | src | pointer to a null-terminated wide string to read from |
| [in] | fmt | format-control wide string. |
| [out] | ... | arguments to write to |
src nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int vswscanf_s | +( | +const wchar_t *restrict | +src, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vswscanf_s function reads a formatted wide string.
+Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf.
| [in] | src | pointer to a null-terminated wide string to read from |
| [in] | fmt | format-control wide string. |
| [in] | ap | arguments to write to |
src nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int wscanf_s | +( | +const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The wscanf_s function reads a formatted wide string from stdin.
Reaching the end of the stdin buffer is equivalent to reaching the end-of-file condition for wscanf.
| [in] | fmt | format-control wide string. |
| [out] | ... | arguments to write to |
fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int vwscanf_s | +( | +const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vwscanf_s function reads a formatted wide string from stdin.
Reaching the end of the stdin buffer is equivalent to reaching the end-of-file condition for vwscanf.
| [in] | fmt | format-control wide string. |
| [out] | ap | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int fwscanf_s | +( | +FILE *restrict | +stream, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The fwscanf_s function reads a formatted wide string.
Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf.
| [in] | stream | pointer to a FILE stream to read from |
| [in] | fmt | format-control wide string. |
| [out] | ... | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) Note it currently even crashes with a NULL pointer. c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN int vfwscanf_s | +( | +FILE *restrict | +stream, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vfwscanf_s function reads a formatted wide string.
Reaching the end of the string is equivalent to reaching the end-of-file condition for fwscanf.
| [in] | stream | pointer to a FILE stream to read from |
| [in] | fmt | format-control wide string. |
| [out] | ap | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a lc into a single wide character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
| EXTERN errno_t _wcsstr_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | wchar_t **restrict | +substringp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wcscmp_s_chk | +( | +const wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wcsncmp_s_chk | +( | +const wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | rsize_t | +count, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wcsicmp_s_chk | +( | +const wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wcsnatcmp_s_chk | +( | +const wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | const int | +fold_case, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wcsset_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t | +value, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _wcsnset_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t | +value, | +
| + | + | size_t | +n, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _wcscoll_s_chk | +( | +const wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wcslwr_s_chk | +( | +wchar_t *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN errno_t _wcsupr_s_chk | +( | +wchar_t *restrict | +src, | +
| + | + | rsize_t | +slen, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
| EXTERN int iswfc | +( | +const uint32_t | +wc | ) | ++ |
| EXTERN int EXTERN int _towfc_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const uint32_t | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t dmax | +
| EXTERN errno_t slen | +
| EXTERN errno_t empty* dest | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strerror_s.c:+Functions | |
| EXPORT errno_t | _strerror_s_chk (char *dest, rsize_t dmax, errno_t errnum, const size_t destbos) |
| EXPORT size_t | strerrorlen_s (errno_t errnum) |
The strerrorlen_s function returns the untruncated length of the textual description of the system error code errnum, identical to the description that would be printed by perror(). More... | |
| EXPORT errno_t _strerror_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | errno_t | +errnum, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXPORT size_t strerrorlen_s | +( | +errno_t | +errnum | ) | ++ |
The strerrorlen_s function returns the untruncated length of the textual description of the system error code errnum, identical to the description that would be printed by perror().
| [in] | errnum | integer value referring to an error code |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strljustify_s.c:+Functions | |
| EXPORT errno_t | _strljustify_s_chk (char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT errno_t _strljustify_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for mbstowcs_s.c:|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsfc_s.c:+Functions | |
| static int | _is_lt_accented (uint32_t wc) |
| EXPORT errno_t | _wcsfc_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t *restrict lenp, const size_t destbos) |
+
|
+ +inlinestatic | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memcmp_s.c:+Functions | |
| EXPORT errno_t | _memcmp_s_chk (const void *dest, rsize_t dmax, const void *src, rsize_t slen, int *diff, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for vscanf_s.c:+Functions | |
| EXPORT int | vscanf_s (const char *restrict fmt, va_list ap) |
The vscanf_s function reads a formatted string from stdin, and writes to a list of arguments. More... | |
| EXPORT int vscanf_s | +( | +const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vscanf_s function reads a formatted string from stdin, and writes to a list of arguments.
Reaching the end of the io buffer is equivalent to reaching the end-of-file condition for fscanf.
| [in] | fmt | format-control string. |
| [out] | ap | arguments to write to |
fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for wmemcpy_s.c:+Functions | |
| EXPORT errno_t | _wmemcpy_s_chk (wchar_t *dest, rsize_t dlen, const wchar_t *src, rsize_t count, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strspn_s.c:+Functions | |
| EXPORT errno_t | _strspn_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t slen, rsize_t *countp, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Data Fields | |
| uint8_t | cc |
| uint32_t | cp |
| size_t | pos |
| uint8_t UNWIF_cc::cc | +
| uint32_t UNWIF_cc::cp | +
| size_t UNWIF_cc::pos | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strrchr_s.c:+Functions | |
| EXPORT errno_t | _strrchr_s_chk (const char *restrict dest, rsize_t dmax, const int ch, char **resultp, const size_t destbos) |
| EXPORT errno_t _strrchr_s_chk | +( | +const char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const int | +ch, | +
| + | + | char ** | +resultp, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This graph shows which files directly or indirectly include this file:+Data Structures | |
| struct | UNWIF_complist |
| struct | UNWIF_complist_s |
+Macros | |
| #define | UNWIF_COMPLIST_FIRST_LONG 0x011099 |
| #define UNWIF_COMPLIST_FIRST_LONG 0x011099 | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strlastdiff_s.c:+Functions | |
| EXPORT errno_t | _strlastdiff_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t *resultp, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcstok_s.c:+Functions | |
| EXPORT wchar_t * | _wcstok_s_chk (wchar_t *restrict dest, rsize_t *restrict dmaxp, const wchar_t *restrict delim, wchar_t **restrict ptr, const size_t destbos) |
| EXPORT wchar_t* _wcstok_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t *restrict | +dmaxp, | +
| + | + | const wchar_t *restrict | +delim, | +
| + | + | wchar_t **restrict | +ptr, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memset16_s.c:+Functions | |
| EXPORT errno_t | _memset16_s_chk (uint16_t *dest, rsize_t dmax, uint16_t value, rsize_t n, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strnset_s.c:+Functions | |
| EXPORT errno_t | _strnset_s_chk (char *restrict dest, rsize_t dmax, int value, rsize_t n, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This graph shows which files directly or indirectly include this file:+Macros | |
| #define | __WORDSIZE (8 * SIZEOF_SIZE_T) |
| #define | ASM_VOLATILE |
| #define | COMPILER_BARRIER |
| #define | MEMORY_BARRIER COMPILER_BARRIER |
+Functions | |
| void | mem_prim_move (void *dest, const void *src, uint32_t len) |
| Moves at most len of bytes from src to dest. More... | |
| void | mem_prim_move8 (uint8_t *dest, const uint8_t *src, uint32_t len) |
| Moves at most len of uint8_t's from src to dest. More... | |
| void | mem_prim_move16 (uint16_t *dest, const uint16_t *src, uint32_t len) |
| Moves at most len uint16_t's from src to dest. More... | |
| void | mem_prim_move32 (uint32_t *dest, const uint32_t *src, uint32_t len) |
| Moves at most len of uint32_t's from src to dest. More... | |
| void | mem_prim_set (void *dest, uint32_t len, uint8_t value) |
| void | mem_prim_set16 (uint16_t *dest, uint32_t len, uint16_t value) |
| Sets len uint16_t's starting at dest to the specified value. More... | |
| void | mem_prim_set32 (uint32_t *dest, uint32_t len, uint32_t value) |
| Sets len uint32_t's starting at dest to the specified value. More... | |
| #define __WORDSIZE (8 * SIZEOF_SIZE_T) | +
| #define ASM_VOLATILE | +
| #define COMPILER_BARRIER | +
| #define MEMORY_BARRIER COMPILER_BARRIER | +
| void mem_prim_move | +( | +void * | +dest, | +
| + | + | const void * | +src, | +
| + | + | uint32_t | +len | +
| + | ) | ++ |
Moves at most len of bytes from src to dest.
+Dest may overlap with src.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | len | maximum number bytes of src that can be copied |
| void mem_prim_move8 | +( | +uint8_t * | +dest, | +
| + | + | const uint8_t * | +src, | +
| + | + | uint32_t | +len | +
| + | ) | ++ |
Moves at most len of uint8_t's from src to dest.
+The destination may overlap with source.
+| [out] | dest | pointer to the memory that will be replaced by src |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | len | maximum number uint8_t of src that can be copied |
| void mem_prim_move16 | +( | +uint16_t * | +dest, | +
| + | + | const uint16_t * | +src, | +
| + | + | uint32_t | +len | +
| + | ) | ++ |
Moves at most len uint16_t's from src to dest.
+The destination may overlap with source.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | len | maximum number uint16_t of src that can be copied |
| void mem_prim_move32 | +( | +uint32_t * | +dest, | +
| + | + | const uint32_t * | +src, | +
| + | + | uint32_t | +len | +
| + | ) | ++ |
Moves at most len of uint32_t's from src to dest.
+The destination may overlap with source.
+| [out] | dest | pointer to the memory that will be replaced by src. |
| [in] | src | pointer to the memory that will be copied to dest |
| [in] | len | maximum number uint32_t of sp that can be copied |
| void mem_prim_set | +( | +void * | +dest, | +
| + | + | uint32_t | +len, | +
| + | + | uint8_t | +value | +
| + | ) | ++ |
| void mem_prim_set16 | +( | +uint16_t * | +dest, | +
| + | + | uint32_t | +len, | +
| + | + | uint16_t | +value | +
| + | ) | ++ |
Sets len uint16_t's starting at dest to the specified value.
+Pointers must meet system alignment requirements.
+| [out] | dest | pointer to memory that will be set to value |
| [in] | len | number of uint16_t's to be set |
| [in] | value | uint16_t value |
| void mem_prim_set32 | +( | +uint32_t * | +dest, | +
| + | + | uint32_t | +len, | +
| + | + | uint32_t | +value | +
| + | ) | ++ |
Sets len uint32_t's starting at dest to the specified value.
+Pointers must meet system alignment requirements.
+| [out] | dest | pointer to memory that will be set to value |
| [in] | len | number of uint32_t's to be set |
| [in] | value | uint32_t value |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strlastsame_s.c:+Functions | |
| EXPORT errno_t | _strlastsame_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t *resultp, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strisdigit_s.c:+Functions | |
| EXPORT bool | _strisdigit_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT bool _strisdigit_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcrtomb_s.c:+Functions | |
| EXPORT errno_t | _wcrtomb_s_chk (size_t *restrict retvalp, char *restrict dest, rsize_t dmax, wchar_t wc, mbstate_t *restrict ps, const size_t destbos) |
| EXPORT errno_t _wcrtomb_s_chk | +( | +size_t *restrict | +retvalp, | +
| + | + | char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | wchar_t | +wc, | +
| + | + | mbstate_t *restrict | +ps, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsnlen_s.c:+Functions | |
| EXPORT rsize_t | _wcsnlen_s_chk (const wchar_t *dest, rsize_t dmax, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memzero32_s.c:+Functions | |
| EXPORT errno_t | _memzero32_s_chk (uint32_t *dest, rsize_t len, const size_t destbos) |
| EXPORT errno_t _memzero32_s_chk | +( | +uint32_t * | +dest, | +
| + | + | rsize_t | +len, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_config.h"#include "safe_lib_errno.h"#include "safe_types.h"#include "safe_compile.h"#include <time.h>
Include dependency graph for safe_lib.h:+Macros | |
| #define | EXTERN extern |
| #define | sl_default_handler ignore_handler_s |
| #define | TMP_MAX_S 308915776 |
| #define | L_tmpnam_s 1024 |
| #define | tmpnam_s(dest, dmax) _tmpnam_s_chk(dest,dmax,BOS(dest)) |
| Creates a unique valid file name (no longer than L_tmpnam in length) and stores it in character string pointed to by filename. More... | |
| #define | gets_s(dest, dmax) _gets_s_chk(dest,dmax,BOS(dest)) |
The gets_s function reads characters from stdin until a newline is found or end-of-file occurs. More... | |
| #define | asctime_s(dest, dmax, tm) _asctime_s_chk(dest,dmax,tm,BOS(dest)) |
The asctime_s function converts the given calendar time tm to a textual representation of the following fixed 25-character form: "Www Mmm dd hh:mm:ss yyyy\n", as with asctime. More... | |
| #define | ctime_s(dest, dmax, timer) _ctime_s_chk(dest,dmax,timer,BOS(dest)) |
The ctime_s function converts the given time since epoch to a calendar local time and then to a textual representation, as if by calling asctime_s(buffer, bufsz, localtime_s(time, &(struct tm){0})). More... | |
| #define | getenv_s(len, dest, dmax, name) _getenv_s_chk(len,dest,dmax,name,BOS(dest)) |
The getenv_s function searches for an environmental variable with name name in the host-specified environment list and returns a pointer to the string that is associated with the matched environment variable. More... | |
| #define | bsearch_s(key, base, nmemb, size, compar, context) _bsearch_s_chk(key,base,nmemb,size,compar,context,BOS(base)) |
The bsearch_s function finds an element equal to element pointed to by key in an array pointed to by base. More... | |
| #define | qsort_s(base, nmemb, size, compar, context) _qsort_s_chk(base,nmemb,size,compar,context,BOS(base)) |
The qsort_s function sorts the given array pointed to by base in ascending order. More... | |
+Functions | |
| EXTERN void | abort_handler_s (const char *restrict msg, void *restrict ptr, errno_t error) |
| This function writes a message on the standard error stream in an implementation-defined format. More... | |
| EXTERN void | ignore_handler_s (const char *restrict msg, void *restrict ptr, errno_t error) |
| This function simply returns to the caller. More... | |
| EXTERN errno_t | _tmpnam_s_chk (const char *dest, rsize_t dmax, const size_t destbos) BOS_OVR2Z(dest |
| EXTERN errno_t | tmpfile_s (FILE *restrict *restrict streamptr) |
The tmpfile_s function creates a temporary binary file that is different from any other existing file and that will automatically be removed when it is closed or at program termination. More... | |
| EXTERN char * | _gets_s_chk (char *dest, rsize_t dmax, const size_t destbos) BOS_CHK(dest) |
| EXTERN errno_t | fopen_s (FILE *restrict *restrict streamptr, const char *restrict filename, const char *restrict mode) |
The fopen_s function opens a file indicated by filename and updates the pointer to the file stream associated with that file. More... | |
| EXTERN errno_t | freopen_s (FILE *restrict *restrict newstreamptr, const char *restrict filename, const char *restrict mode, FILE *restrict stream) |
The freopen_s function first, attempts to close the file associated with the stream, ignoring any errors. More... | |
| EXTERN errno_t | _asctime_s_chk (char *dest, rsize_t dmax, const struct tm *tm, const size_t destbos) BOS_CHK(dest) BOS_ATTR(dmax< 26 |
| EXTERN errno_t dmax underflow | BOS_NULL (tm) |
| EXTERN errno_t | _ctime_s_chk (char *dest, rsize_t dmax, const time_t *timer, const size_t destbos) BOS_CHK(dest) BOS_ATTR(dmax< 26 |
| EXTERN errno_t dmax underflow | BOS_NULL (timer) |
| EXTERN struct tm * | gmtime_s (const time_t *restrict timer, struct tm *restrict dest) BOS_NULL(timer) BOS_NULL(dest) |
The gmtime_s function converts the given time since epoch to a calendar time, expressed in Coordinated Universal Time (UTC) in the struct tm format. More... | |
| EXTERN struct tm * | localtime_s (const time_t *restrict timer, struct tm *restrict dest) BOS_NULL(timer) BOS_NULL(dest) |
The localtime_s function converts the given time since epoch to a calendar time, expressed in the current timezone in the struct tm format. More... | |
| EXTERN errno_t | _getenv_s_chk (size_t *restrict len, char *restrict dest, rsize_t dmax, const char *restrict name, const size_t destbos) BOS_CHK(dest) BOS_ATTR(_BOS_NULL(name) |
| EXTERN void * | _bsearch_s_chk (const void *key, const void *base, rsize_t nmemb, rsize_t size, int(*compar)(const void *k, const void *y, void *context), void *context, const size_t basebos) BOS_ATTR(nmemb &&(_BOS_NULL(key)||_BOS_NULL(base)||_BOS_ZERO(base |
| EXTERN void nmemb empty buf or bufsize | BOS_ATTR (nmemb &&!compar, "empty compar") |
| EXTERN errno_t | _qsort_s_chk (void *base, rsize_t nmemb, rsize_t size, int(*compar)(const void *x, const void *y, void *context), void *context, const size_t basebos) BOS_ATTR(nmemb &&(_BOS_NULL(base)||_BOS_ZERO(base |
+Variables | |
| EXTERN errno_t | dmax |
| EXTERN errno_t empty | name |
| EXTERN void nmemb * | size |
| #define EXTERN extern | +
| #define sl_default_handler ignore_handler_s | +
| #define TMP_MAX_S 308915776 | +
| #define L_tmpnam_s 1024 | +
| #define tmpnam_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_tmpnam_s_chk(dest,dmax,BOS(dest)) | +
Creates a unique valid file name (no longer than L_tmpnam in length) and stores it in character string pointed to by filename.
+The function is capable of generating up to TMP_MAX_S of unique filenames, but some or all of them may be in use in the filesystem and thus not suitable return values.
+| [out] | dest | pointer to the string capable of holding at least L_tmpnam_s bytes, to be used as a result buffer. |
| [in] | dmax | maximum number of characters the function is allowed to write (typically the size of the dest buffer). |
| EOK | on success |
| ESNULLP | when dest is a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR or more than TMP_MAX_S files were opened. |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| errno() | when tmpnam() failed, typically -ENOENT |
POSIX systems additionally define the similarly named function tempnam(), which offers the choice of a directory (which defaults to the optionally defined macro P_tmpdir).
+ +| #define gets_s | +( | ++ | dest, | +
| + | + | + | dmax | +
| + | ) | +_gets_s_chk(dest,dmax,BOS(dest)) | +
The gets_s function reads characters from stdin until a newline is found or end-of-file occurs.
Writes only at most dmax characters into the array pointed to by str, and always writes the terminating null character.
+Note that C11 allows only writing dmax-1 character. We need to work with the system fgets() passing it dmax+1. In any case, gets_s first finishes reading and discarding the characters from stdin until new-line character, end-of-file condition, or read error before calling the constraint handler. With SAFECLIB_STR_NULL_SLACK the rest of dmax is cleared with NULL bytes, without all elements following the terminating null character (if any) written by gets_s in the array of dmax characters pointed to by dest take unspecified values when gets_s returns.
+| [out] | dest | character string to be written. If the resulting concatenated string is less than dmax, the remaining slack space is nulled. |
| [in] | dmax | restricted maximum length of the resulting dest, including the null. it may temp. write dmax+1, but always return max dmax. |
| >0 | when successful operation, all the characters from src were appended to dest and the result in dest is null terminated. |
| 0 | + errno=ESNULLP when dest is a NULL pointer |
| 0 | + errno=ESZEROL when dmax = 0 |
| 0 | + errno=ESLEMAX when dmax > RSIZE_MAX_STR |
| 0 | + errno=EOVERFLOW when dmax > size of dest |
| 0 | + errno=ESUNTERM endline or eof not encountered after storing dmax-1 characters to dest. |
| #define asctime_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | tm | +
| + | ) | +_asctime_s_chk(dest,dmax,tm,BOS(dest)) | +
The asctime_s function converts the given calendar time tm to a textual representation of the following fixed 25-character form: "Www Mmm dd hh:mm:ss yyyy\n", as with asctime.
The message is copied into user-provided dest buffer, which is guaranteed to be null-terminated.
No more than dmax-1 bytes are written, the buffer is always null-terminated. Uses the re-entrant asctime_r() if available.
| [out] | dest | pointer to a user-provided buffer. |
| [in] | dmax | restricted maximum length of dest |
| [in] | tm | pointer to a tm object specifying the time to print |
| EOK | on success |
| ESNULLP | when dest or tm is a NULL pointer |
| ESLEMIN | when dmax < 26 or a tm member is too small |
| ESLEMAX | when dmax > RSIZE_MAX_STR or a tm member is too large |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESNOSPC | when dmax is too small for the result buffer |
| -1 | when asctime_r or asctime returned NULL |
| #define ctime_s | +( | ++ | dest, | +
| + | + | + | dmax, | +
| + | + | + | timer | +
| + | ) | +_ctime_s_chk(dest,dmax,timer,BOS(dest)) | +
The ctime_s function converts the given time since epoch to a calendar local time and then to a textual representation, as if by calling asctime_s(buffer, bufsz, localtime_s(time, &(struct tm){0})).
The message is copied into the user-provided dest buffer, which is guaranteed to be null-terminated.
No more than dmax-1 bytes are written, the buffer is always null-terminated. The function does not support localization. Uses the re-entrant ctime_r() if available.
| [out] | dest | pointer to a user-provided string buffer. |
| [in] | dmax | restricted maximum length of dest |
| [in] | timer | pointer to a epoch (long, seconds since 1970) |
| EOK | on success |
| ESNULLP | when dest or tm is a NULL pointer |
| ESLEMIN | when dmax < 26 or *timer < 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != size of dest and –enable-error-dmax |
| ESLEMAX | when *timer > 313360441200L, the year 10000, resp. LONG_MAX on 32bit systems |
| ESNOSPC | when dmax is too small for the result buffer |
| -1 | when ctime_r or ctime returned NULL |
| #define getenv_s | +( | ++ | len, | +
| + | + | + | dest, | +
| + | + | + | dmax, | +
| + | + | + | name | +
| + | ) | +_getenv_s_chk(len,dest,dmax,name,BOS(dest)) | +
The getenv_s function searches for an environmental variable with name name in the host-specified environment list and returns a pointer to the string that is associated with the matched environment variable.
The set of environmental variables and methods of altering it are implementation-defined. The value of the environment variable is written to the user-provided buffer value (unless null) and the number of bytes written is stored in the user-provided location *len (unless null). If the environment variable is not set in the environment, zero is written to *len (unless null) and '\0' is written to value[0] (unless null). 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. If secure_getenv() is available, it is used.
| [out] | len | pointer to a size_t where getenv_s will store the length of the found environment variable. Might be NULL. |
| [out] | dest | pointer to a string where getenv_s will store the contents of the found environment variable. |
| [in] | dmax | maximum number of characters that getenv_s is allowed to write to dest (size of the buffer). |
| [in] | name | null-terminated character string identifying the name of the environmental variable to look for. |
| EOK | on success |
| ESNULLP | when dest or name are a NULL pointer |
| ESZEROL | when dmax = 0 |
| ESLEMAX | when dmax > RSIZE_MAX_STR |
| EOVERFLOW | when dmax > size of dest (optionally, when the compiler knows the object_size statically) |
| ESLEWRNG | when dmax != sizeof(dest) and –enable-error-dmax |
| ESNOSPC | when dmax is too small for the value |
| -1 | when not found |
| #define bsearch_s | +( | ++ | key, | +
| + | + | + | base, | +
| + | + | + | nmemb, | +
| + | + | + | size, | +
| + | + | + | compar, | +
| + | + | + | context | +
| + | ) | +_bsearch_s_chk(key,base,nmemb,size,compar,context,BOS(base)) | +
The bsearch_s function finds an element equal to element pointed to by key in an array pointed to by base.
The array contains count elements of size bytes and must be partitioned with respect to key, that is, all the elements that compare less than must appear before all the elements that compare equal to, and those must appear before all the elements that compare greater than the key object. A fully sorted array satisfies these requirements. The elements are compared using function pointed to by comp. The behavior is undefined if the array is not already partitioned with respect to *key in ascending order according to the same criterion that compar uses.
+| [in] | key | pointer to the element to search for |
| [in] | base | pointer to the array to examine |
| [in] | nmemb | number of elements in the array |
| [in] | size | size of each element in the array in bytes |
| [in] | compar | comparison function which returns a negative integer value if the first argument is less than the second, a positive integer value if the first argument is greater than the second and zero if the arguments are equal. key is passed as the first argument, an element from the array as the second. The signature of the comparison function should be equivalent to the following: int cmp(const void *a, const void *b); The function must not modify the objects passed to it and must return consistent results when called for the same objects, regardless of their positions in the array. |
| [in] | context | additional information (e.g., collating sequence), passed to compar as the third argument |
If the array contains several elements that compar would indicate as equal to the element searched for, then it is unspecified which element the function will return as the result.
+| NULL | when not found or any error |
errno values: ESNULLP when key, base or compar are a NULL pointer, and nmemb is > 0 ESLEMAX when nmemb or size > RSIZE_MAX_MEM
+| #define qsort_s | +( | ++ | base, | +
| + | + | + | nmemb, | +
| + | + | + | size, | +
| + | + | + | compar, | +
| + | + | + | context | +
| + | ) | +_qsort_s_chk(base,nmemb,size,compar,context,BOS(base)) | +
The qsort_s function sorts the given array pointed to by base in ascending order.
The array contains nmemb elements of size bytes. Function pointed to by compar is used for object comparison.
+| [in] | base | pointer to the array to sort |
| [in] | nmemb | number of elements in the array |
| [in] | size | size of each element in the array in bytes |
| [in] | compar | comparison function which returns a negative integer value if the first argument is less than the second, a positive integer value if the first argument is greater than the second and zero if the arguments are equal. key is passed as the first argument, an element from the array as the second. The signature of the comparison function should be equivalent to the following: int cmp(const void *a, const void *b, const void *context); The function must not modify the objects passed to it and must return consistent results when called for the same objects, regardless of their positions in the array. |
| [in] | context | additional information (e.g., collating sequence), passed to compar as the third argument |
If comp indicates two elements as equivalent, their order in the resulting sorted array is unspecified.
+qsort_s does not treat arrays of zero size as a runtime constraint violation and instead returns successfully without altering the array (the other function that accepts arrays of zero size is bsearch_s). Until qsort_s, users of qsort often used global variables to pass additional context to the comparison function.This function is available under windows with a different API, no return type, and is not available with safeclib.
+| EOK | when operation is successful |
| -ESNULLP | when base/compar is NULL pointer and nmemb > 0 |
| -ESLEMAX | when nmemb/size > RSIZE_MAX_MEM |
| EXTERN void abort_handler_s | +( | +const char *restrict | +msg, | +
| + | + | void *restrict | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
This function writes a message on the standard error stream in an implementation-defined format.
+The message shall include the string pointed to by msg. The abort_handler_s function then calls the abort function.
+| [in] | msg | Pointer to the message describing the error |
| [in] | ptr | Pointer to aassociated data. Can be NULL. |
| [in] | error | The error code encountered. |
| EXTERN void ignore_handler_s | +( | +const char *restrict | +msg, | +
| + | + | void *restrict | +ptr, | +
| + | + | errno_t | +error | +
| + | ) | ++ |
This function simply returns to the caller.
+| [in] | msg | Pointer to the message describing the error |
| [in] | ptr | Pointer to aassociated data. Can be NULL. |
| [in] | error | The error code encountered. |
| EXTERN errno_t _tmpnam_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t tmpfile_s | +( | +FILE *restrict *restrict | +streamptr | ) | ++ |
The tmpfile_s function creates a temporary binary file that is different from any other existing file and that will automatically be removed when it is closed or at program termination.
If the program terminates abnormally, whether an open temporary file is removed is implementation-defined. The file is opened for update with "wb+" mode with the meaning that mode has in the fopen_s function (including the mode’s effect on exclusive access and file permissions).
| streamptr | pointer to a pointer that will be updated by this function call |
If the file was created successfully, then the pointer to FILE pointed to by streamptr will be set to the pointer to the object controlling the opened file. Otherwise, the pointer to FILE pointed to by streamptr will be set to a null pointer.
+| EOK | on success |
| ESNULLP | when streamptr is a NULL pointer |
| ESLEMAX | when more than TMP_MAX_S files were opened. |
| errno() | when tmpfile() failed, typically ENOENT or EACCES |
| EXTERN char* _gets_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t fopen_s | +( | +FILE *restrict *restrict | +streamptr, | +
| + | + | const char *restrict | +filename, | +
| + | + | const char *restrict | +mode | +
| + | ) | ++ |
The fopen_s function opens a file indicated by filename and updates the pointer to the file stream associated with that file.
mode is used to determine the file access mode.
+| [out] | streamptr | pointer to a FILE stream that will be updated by this function call |
| [in] | filename | |
| [in] | mode | as in fopen |
If the file was created successfully, then the pointer to the FILE pointed to by streamptr will be set to the pointer to the object controlling the opened file. Otherwise, the pointer to the FILE pointed to by streamptr will be set to a null pointer.
+| EOK | on success |
| ESNULLP | when any argument is a NULL pointer |
| > | 0 any other errno |
| EXTERN errno_t freopen_s | +( | +FILE *restrict *restrict | +newstreamptr, | +
| + | + | const char *restrict | +filename, | +
| + | + | const char *restrict | +mode, | +
| + | + | FILE *restrict | +stream | +
| + | ) | ++ |
The freopen_s function first, attempts to close the file associated with the stream, ignoring any errors.
Then, if filename is not null, attempts to open the file specified by filename using mode as if by fopen, and associates that file with the file stream pointed to by stream. If filename is a null pointer, then the function attempts to reopen the file that is already associated with stream (it is implementation defined which mode changes are allowed in this case).
+| [out] | newstreamptr | pointer to a FILE stream that will be updated by this function call |
| [in] | filename | file name to associate the file stream to |
| [in] | mode | as in fopen |
| [in] | stream | the file stream to modify |
If the file was reopened successfully, then the pointer to the FILE pointed to by newstreamptr will be set to the pointer to the object controlling the opened file. Otherwise, the pointer to the FILE pointed to by newstreamptr will be set to a null pointer.
+| EOK | on success |
| ESNULLP | when any argument is a NULL pointer |
| > | 0 any other errno |
| EXTERN errno_t _asctime_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const struct tm * | +tm, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN errno_t _ctime_s_chk | +( | +char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const time_t * | +timer, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN struct tm* gmtime_s | +( | +const time_t *restrict | +timer, | +
| + | + | struct tm *restrict | +dest | +
| + | ) | ++ |
The gmtime_s function converts the given time since epoch to a calendar time, expressed in Coordinated Universal Time (UTC) in the struct tm format.
The result is copied into the user-provided tm struct.
+| [in] | timer | pointer to a epoch (long, seconds since 1970) |
| [out] | dest | pointer to a user-provided struct tm. |
POSIX requires that this function sets errno to EOVERFLOW if it fails because the argument is too large. POSIX defines a thread-safe alternative gmtime_r, which is similar to the C11 function gmtime_s, except that it does not check the validity of its input parameters.
+This function is available under windows with a different API, reversed argument order, and is not available with safeclib.
+| EXTERN struct tm* localtime_s | +( | +const time_t *restrict | +timer, | +
| + | + | struct tm *restrict | +dest | +
| + | ) | ++ |
The localtime_s function converts the given time since epoch to a calendar time, expressed in the current timezone in the struct tm format.
The result is copied into the user-provided tm struct.
+| [in] | timer | pointer to a epoch (long, seconds since 1970) |
| [out] | dest | pointer to a user-provided struct tm. |
POSIX requires that this function sets errno to EOVERFLOW if it fails because the argument is too large. POSIX defines a thread-safe alternative localtime_r, which is similar to the C11 function localtime_s, except that it does not check the validity of its input parameters.
+This function is available under windows with a different API, reversed argument order, and is not available with safeclib.
+| EXTERN errno_t _getenv_s_chk | +( | +size_t *restrict | +len, | +
| + | + | char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +name, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| EXTERN void* _bsearch_s_chk | +( | +const void * | +key, | +
| + | + | const void * | +base, | +
| + | + | rsize_t | +nmemb, | +
| + | + | rsize_t | +size, | +
| + | + | int(*)(const void *k, const void *y, void *context) | +compar, | +
| + | + | void * | +context, | +
| + | + | const size_t | +basebos | +
| + | ) | +&& | +
| EXTERN errno_t nmemb empty buf or bufsize BOS_ATTR | +( | +nmemb &&! | +compar, | +
| + | + | "empty compar" | ++ |
| + | ) | ++ |
| EXTERN errno_t _qsort_s_chk | +( | +void * | +base, | +
| + | + | rsize_t | +nmemb, | +
| + | + | rsize_t | +size, | +
| + | + | int(*)(const void *x, const void *y, void *context) | +compar, | +
| + | + | void * | +context, | +
| + | + | const size_t | +basebos | +
| + | ) | +&& | +
| EXTERN errno_t dmax | +
| EXTERN errno_t empty name | +
| EXTERN errno_t nmemb * size | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vsnprintf_s.c:+Functions | |
| EXPORT int | _vsnprintf_s_chk (char *restrict dest, rsize_t dmax, const size_t destbos, const char *restrict fmt, va_list ap) |
| EXPORT int _vsnprintf_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Functions | |
| bool | isExclusion (uint32_t uv) |
| bool | isSingleton (uint32_t uv) |
| bool | isNonStDecomp (uint32_t uv) |
| bool | isComp2nd (uint32_t uv) |
| bool isExclusion | +( | +uint32_t | +uv | ) | ++ |
| bool isSingleton | +( | +uint32_t | +uv | ) | ++ |
| bool isNonStDecomp | +( | +uint32_t | +uv | ) | ++ |
| bool isComp2nd | +( | +uint32_t | +uv | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memcpy32_s.c:+Functions | |
| EXPORT errno_t | _memcpy32_s_chk (uint32_t *dest, rsize_t dmax, const uint32_t *src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strstr_s.c:+Functions | |
| EXPORT errno_t | _strstr_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, char **substringp, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcpyfldin_s.c:+Functions | |
| EXPORT errno_t | _strcpyfldin_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strnlen_s.c:+Functions | |
| EXPORT rsize_t | _strnlen_s_chk (const char *str, rsize_t smax, const size_t strbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Macros | |
| #define | NORMALIZE_IND_TBL |
| #define | UNWIF_canon_MAXLEN 4 |
| #define | TBL(i) ((i-1) << 12) |
| #define | UNWIF_canon_LEN(v) (((v) >> 12) + 1) |
| #define | UNWIF_canon_IDX(v) ((v) & 0xfff) |
| #define | UNWIF_canon_PLANE_T uint16_t |
| #define | UNWIF_canon_exc_size 0 |
+Variables | |
| static const wchar_t | UNWIF_canon_tbl_1 [917][1] |
| static const wchar_t | UNWIF_canon_tbl_2 [762][2] |
| static const wchar_t | UNWIF_canon_tbl_3 [227][3] |
| static const wchar_t | UNWIF_canon_tbl_4 [36][4] |
| static const wchar_t * | UNWIF_canon_tbl [4] |
| static const uint16_t | UNWIF_canon_00_00 [256] |
| static const uint16_t | UNWIF_canon_00_01 [256] |
| static const uint16_t | UNWIF_canon_00_02 [256] |
| static const uint16_t | UNWIF_canon_00_03 [256] |
| static const uint16_t | UNWIF_canon_00_04 [256] |
| static const uint16_t | UNWIF_canon_00_06 [256] |
| static const uint16_t | UNWIF_canon_00_09 [256] |
| static const uint16_t | UNWIF_canon_00_0a [256] |
| static const uint16_t | UNWIF_canon_00_0b [256] |
| static const uint16_t | UNWIF_canon_00_0c [256] |
| static const uint16_t | UNWIF_canon_00_0d [256] |
| static const uint16_t | UNWIF_canon_00_0f [256] |
| static const uint16_t | UNWIF_canon_00_10 [256] |
| static const uint16_t | UNWIF_canon_00_1b [256] |
| static const uint16_t | UNWIF_canon_00_1e [256] |
| static const uint16_t | UNWIF_canon_00_1f [256] |
| static const uint16_t | UNWIF_canon_00_20 [256] |
| static const uint16_t | UNWIF_canon_00_21 [256] |
| static const uint16_t | UNWIF_canon_00_22 [256] |
| static const uint16_t | UNWIF_canon_00_23 [256] |
| static const uint16_t | UNWIF_canon_00_2a [256] |
| static const uint16_t | UNWIF_canon_00_30 [256] |
| static const uint16_t | UNWIF_canon_00_f9 [256] |
| static const uint16_t | UNWIF_canon_00_fa [256] |
| static const uint16_t | UNWIF_canon_00_fb [256] |
| static const uint16_t | UNWIF_canon_01_10 [256] |
| static const uint16_t | UNWIF_canon_01_11 [256] |
| static const uint16_t | UNWIF_canon_01_13 [256] |
| static const uint16_t | UNWIF_canon_01_14 [256] |
| static const uint16_t | UNWIF_canon_01_15 [256] |
| static const uint16_t | UNWIF_canon_01_d1 [256] |
| static const uint16_t | UNWIF_canon_02_f8 [256] |
| static const uint16_t | UNWIF_canon_02_f9 [256] |
| static const uint16_t | UNWIF_canon_02_fa [256] |
| static const uint16_t * | UNWIF_canon_00 [256] |
| static const uint16_t * | UNWIF_canon_01 [256] |
| static const uint16_t * | UNWIF_canon_02 [256] |
| static const uint16_t ** | UNWIF_canon [] |
| #define NORMALIZE_IND_TBL | +
| #define UNWIF_canon_MAXLEN 4 | +
| #define TBL | +( | ++ | i | ) | +((i-1) << 12) | +
| #define UNWIF_canon_LEN | +( | ++ | v | ) | +(((v) >> 12) + 1) | +
| #define UNWIF_canon_IDX | +( | ++ | v | ) | +((v) & 0xfff) | +
| #define UNWIF_canon_PLANE_T uint16_t | +
| #define UNWIF_canon_exc_size 0 | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsnset_s.c:+Functions | |
| EXPORT errno_t | _wcsnset_s_chk (wchar_t *restrict dest, rsize_t dmax, wchar_t value, rsize_t n, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for towfc_s.c:+Functions | |
| int | iswfc (const uint32_t wc) |
| int | _towfc_single (wchar_t *restrict dest, const uint32_t src) |
| EXPORT int | _towfc_s_chk (wchar_t *restrict dest, rsize_t dmax, const uint32_t src, const size_t destbos) |
+Variables | |
| struct { | |
| unsigned short upper | |
| unsigned short lower1 | |
| unsigned short lower2 | |
| } | tbl2 [] |
| iswfc() checks the uppercase character for a mapping to foldcase, returning the number of new wide character codepoints needed. More... | |
| struct { | |
| unsigned short upper | |
| unsigned short lower1 | |
| unsigned short lower2 | |
| unsigned short lower3 | |
| } | tbl3 [] |
| int iswfc | +( | +const uint32_t | +wc | ) | ++ |
| int _towfc_single | +( | +wchar_t *restrict | +dest, | +
| + | + | const uint32_t | +src | +
| + | ) | ++ |
| EXPORT int _towfc_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const uint32_t | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
| unsigned short upper | +
| unsigned short lower1 | +
| unsigned short lower2 | +
| const { ... } tbl2[] | +
iswfc() checks the uppercase character for a mapping to foldcase, returning the number of new wide character codepoints needed.
+The usual iswupper(wc) case returns 1, and the special 104 full folding cases as specified in Unicode 10.0 CaseFolding.txt return either 2 or 3.
| [in] | wc | unicode character codepoint |
| 0 | when there is no corresponding lowercase mapping. |
| 1 | when there is a corresponding common or simple foldcase mapping. |
| 2 | a full case-folding expands to 2 characters |
| 3 | a full case-folding expands to 3 characters |
| unsigned short lower3 | +
| const { ... } tbl3[] | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsncpy_s.c:+Functions | |
| EXPORT errno_t | _wcsncpy_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for localtime_s.c:+Functions | |
| EXPORT struct tm * | localtime_s (const time_t *restrict timer, struct tm *restrict dest) |
The localtime_s function converts the given time since epoch to a calendar time, expressed in the current timezone in the struct tm format. More... | |
| EXPORT struct tm* localtime_s | +( | +const time_t *restrict | +timer, | +
| + | + | struct tm *restrict | +dest | +
| + | ) | ++ |
The localtime_s function converts the given time since epoch to a calendar time, expressed in the current timezone in the struct tm format.
The result is copied into the user-provided tm struct.
+| [in] | timer | pointer to a epoch (long, seconds since 1970) |
| [out] | dest | pointer to a user-provided struct tm. |
POSIX requires that this function sets errno to EOVERFLOW if it fails because the argument is too large. POSIX defines a thread-safe alternative localtime_r, which is similar to the C11 function localtime_s, except that it does not check the validity of its input parameters.
+This function is available under windows with a different API, reversed argument order, and is not available with safeclib.
+|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for fopen_s.c:+Functions | |
| EXPORT errno_t | fopen_s (FILE *restrict *restrict streamptr, const char *restrict filename, const char *restrict mode) |
The fopen_s function opens a file indicated by filename and updates the pointer to the file stream associated with that file. More... | |
| EXPORT errno_t fopen_s | +( | +FILE *restrict *restrict | +streamptr, | +
| + | + | const char *restrict | +filename, | +
| + | + | const char *restrict | +mode | +
| + | ) | ++ |
The fopen_s function opens a file indicated by filename and updates the pointer to the file stream associated with that file.
mode is used to determine the file access mode.
+| [out] | streamptr | pointer to a FILE stream that will be updated by this function call |
| [in] | filename | |
| [in] | mode | as in fopen |
If the file was created successfully, then the pointer to the FILE pointed to by streamptr will be set to the pointer to the object controlling the opened file. Otherwise, the pointer to the FILE pointed to by streamptr will be set to a null pointer.
+| EOK | on success |
| ESNULLP | when any argument is a NULL pointer |
| > | 0 any other errno |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include <stdio.h>#include <sys/types.h>#include <inttypes.h>#include <stdint.h>#include <errno.h>#include <stdbool.h>
Include dependency graph for safe_types.h:
This graph shows which files directly or indirectly include this file:+Macros | |
| #define | RSIZE_MAX (~(rsize_t)0) /* leave here for completeness */ |
+Typedefs | |
| typedef size_t | rsize_t |
| #define RSIZE_MAX (~(rsize_t)0) /* leave here for completeness */ | +
| typedef size_t rsize_t | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for vswprintf_s.c:+Macros | |
| #define | __STDC_WANT_LIB_EXT1__ 1 |
+Functions | |
| EXPORT int | _vswprintf_s_chk (wchar_t *restrict dest, rsize_t dmax, const size_t destbos, const wchar_t *restrict fmt, va_list ap) |
| #define __STDC_WANT_LIB_EXT1__ 1 | +
| EXPORT int _vswprintf_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcpyfld_s.c:+Functions | |
| EXPORT errno_t | _strcpyfld_s_chk (char *dest, rsize_t dmax, const char *src, rsize_t slen, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcspn_s.c:+Functions | |
| EXPORT errno_t | _strcspn_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t slen, rsize_t *countp, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include <unwifcpt.h>
+Data Fields | |
| uint32_t | cp |
| wchar_t * | v |
| const uint16_t | cp |
| const wchar_t * | v |
| uint32_t UNWIF_compat_exc_t::cp | +
| wchar_t* UNWIF_compat_exc_t::v | +
| const uint16_t UNWIF_compat_exc_t::cp | +
| const wchar_t* UNWIF_compat_exc_t::v | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcat_s.c:+Functions | |
| EXPORT errno_t | _strcat_s_chk (char *restrict dest, rsize_t dmax, const char *restrict src, size_t destbos) |
| EXPORT errno_t _strcat_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strisuppercase_s.c:+Functions | |
| EXPORT bool | _strisuppercase_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT bool _strisuppercase_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memcpy16_s.c:+Functions | |
| EXPORT errno_t | _memcpy16_s_chk (uint16_t *dest, rsize_t dmax, const uint16_t *src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strnterminate_s.c:+Functions | |
| EXPORT rsize_t | _strnterminate_s_chk (char *dest, rsize_t dmax, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memrchr_s.c:+Functions | |
| EXPORT errno_t | _memrchr_s_chk (const void *restrict dest, rsize_t dmax, const int ch, void **result, const size_t destbos) |
| EXPORT errno_t _memrchr_s_chk | +( | +const void *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const int | +ch, | +
| + | + | void ** | +result, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsstr_s.c:+Functions | |
| EXPORT errno_t | _wcsstr_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t slen, wchar_t **restrict substringp, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcsncmp_s.c:+Functions | |
| EXPORT errno_t | _wcsncmp_s_chk (const wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, rsize_t smax, rsize_t count, int *resultp, const size_t destbos, const size_t srcbos) |
| EXPORT errno_t _wcsncmp_s_chk | +( | +const wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | rsize_t | +smax, | +
| + | + | rsize_t | +count, | +
| + | + | int * | +resultp, | +
| + | + | const size_t | +destbos, | +
| + | + | const size_t | +srcbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memset_s.c:+Functions | |
| EXPORT errno_t | _memset_s_chk (void *dest, rsize_t dmax, int value, rsize_t n, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for vfprintf_s.c:+Functions | |
| EXPORT int | vfprintf_s (FILE *restrict stream, const char *restrict fmt, va_list ap) |
| The vfprintf_s function composes a string via the format string and writes it to a FILE buffer. More... | |
| EXPORT int vfprintf_s | +( | +FILE *restrict | +stream, | +
| + | + | const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vfprintf_s function composes a string via the format string and writes it to a FILE buffer.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vfprintf call fails, errno is set.| [out] | stream | output file stream to write to |
| [in] | fmt | format-control string. |
| [in] | ap | optional arguments |
| -ESNULLP | when stream/fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then. |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcscpy_s.c:+Functions | |
| EXPORT errno_t | _wcscpy_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, const size_t destbos) |
| EXPORT errno_t _wcscpy_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strfirstdiff_s.c:+Functions | |
| EXPORT errno_t | _strfirstdiff_s_chk (const char *dest, rsize_t dmax, const char *src, rsize_t *resultp, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for wcscat_s.c:+Functions | |
| EXPORT errno_t | _wcscat_s_chk (wchar_t *restrict dest, rsize_t dmax, const wchar_t *restrict src, const size_t destbos) |
| EXPORT errno_t _wcscat_s_chk | +( | +wchar_t *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const wchar_t *restrict | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strislowercase_s.c:+Functions | |
| EXPORT bool | _strislowercase_s_chk (const char *dest, rsize_t dmax, const size_t destbos) |
| EXPORT bool _strislowercase_s_chk | +( | +const char * | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memcpy_s.c:+Functions | |
| EXPORT errno_t | _memcpy_s_chk (void *restrict dest, rsize_t dmax, const void *restrict src, rsize_t slen, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include <unwifcmp.h>
+Data Fields | |
| uint32_t | nextchar |
| uint32_t | composite |
| uint32_t UNWIF_complist::nextchar | +
| uint32_t UNWIF_complist::composite | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for fwprintf_s.c:+Functions | |
| EXPORT int | fwprintf_s (FILE *restrict stream, const wchar_t *restrict fmt,...) |
| The fwprintf_s function prints formatted output to a wide stream. More... | |
| EXPORT int fwprintf_s | +( | +FILE *restrict | +stream, | +
| + | + | const wchar_t *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The fwprintf_s function prints formatted output to a wide stream.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vfwprintf call fails, errno is set.| [in] | stream | output wide stream to write to |
| [in] | fmt | format-control wide string. |
| [in] | ... | optional arguments |
n s is a null pointer (not yet) | -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | some other error. errno: EINVAL or EOVERFLOW |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for vprintf_s.c:+Functions | |
| EXPORT int | vprintf_s (const char *restrict fmt, va_list ap) |
| The vprintf_s function composes a string via the format string and writes it to a FILE buffer. More... | |
| EXPORT int vprintf_s | +( | +const char *restrict | +fmt, | +
| + | + | va_list | +ap | +
| + | ) | ++ |
The vprintf_s function composes a string via the format string and writes it to a FILE buffer.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vprintf call fails, errno is set.| [in] | fmt | format-control string |
| [in] | ap | optional arguments |
| -ESNULLP | when fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then. |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strpbrk_s.c:+Functions | |
| EXPORT errno_t | _strpbrk_s_chk (char *dest, rsize_t dmax, char *src, rsize_t slen, char **firstp, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for wmemmove_s.c:+Functions | |
| EXPORT errno_t | _wmemmove_s_chk (wchar_t *dest, rsize_t dlen, const wchar_t *src, rsize_t count, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_mem_lib.h"
Include dependency graph for memcmp32_s.c:+Functions | |
| EXPORT errno_t | _memcmp32_s_chk (const uint32_t *dest, rsize_t dlen, const uint32_t *src, rsize_t slen, int *diff, const size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This graph shows which files directly or indirectly include this file:+Macros | |
| #define | __has_attribute(x) 0 |
| Since clang-5 most constraints can be caught at compile-time. More... | |
| #define | BOS_UNKNOWN ((size_t)-1) |
| #define | _BOS_KNOWN(dest) ((size_t)BOS(dest) != BOS_UNKNOWN) |
| #define | BOS(dest) BOS_UNKNOWN |
| #define | BOSW(dest) BOS_UNKNOWN |
| #define | _BOS_CHK(dest) 0 |
| #define | _BOSW_CHK(dest) 0 |
| #define | _BOS_ZERO(dest) 0 |
| #define | _BOS_NULL(dest) 0 |
| #define | _BOS_OVR_N(dest, dmax) 0 |
| #define | bos_chk_err "error" |
| #define | _XSTR(s) _STR(s) |
| #define | _STR(s) #s |
| #define | BOS_CHK(dest) |
| #define | BOSW_CHK(dest) |
| #define | BOS_CHK2(buf, bufsize) |
| #define | BOSW_CHK2(buf, bufsize) |
| #define | BOS_OVR_BUTNULL(dest) |
| #define | BOSW_OVR_BUTNULL(dest) |
| #define | BOS_CHK_BUTZERO(dest, slen) |
| #define | BOSW_CHK_BUTZERO(dest, slen) |
| #define | BOS_OVR2(buf, bufsize) |
| #define | BOSW_OVR2(buf, bufsize) |
| #define | BOS_OVR2Z(buf, bufsize) |
| #define | BOSW_OVR2Z(buf, bufsize) |
| #define | BOS_OVR2_BUTZERO(buf, bufsize) |
| #define | BOSW_OVR2_BUTZERO(buf, bufsize) |
| #define | BOS_OVR2_BUTNULL(buf, bufsize) |
| #define | BOSW_OVR2_BUTNULL(buf, bufsize) |
| #define | VAL_OVR2(value, vmax) |
| #define | VAL_OVR2_BUTZERO(value, vmax) |
| #define | BOS_NULL(buf) |
| #define | BOS_NULLPTR(buf) |
| #define | BOS_FMT(fmt) |
| #define | BOS_ATTR(chk, msg) |
+Typedefs | |
| typedef void(* | constraint_handler_t) (const char *restrict, void *restrict, errno_t) |
| #define __has_attribute | +( | ++ | x | ) | +0 | +
Since clang-5 most constraints can be caught at compile-time.
+For pointer sizes we need BOS/__builtin_object_size(), for diagnostics attribute((diagnose_if())) gcc violations might be caught with _Static_assert, but this is limited.
+ +| #define BOS_UNKNOWN ((size_t)-1) | +
| #define _BOS_KNOWN | +( | ++ | dest | ) | +((size_t)BOS(dest) != BOS_UNKNOWN) | +
| #define BOS | +( | ++ | dest | ) | +BOS_UNKNOWN | +
| #define BOSW | +( | ++ | dest | ) | +BOS_UNKNOWN | +
| #define _BOS_CHK | +( | ++ | dest | ) | +0 | +
| #define _BOSW_CHK | +( | ++ | dest | ) | +0 | +
| #define _BOS_ZERO | +( | ++ | dest | ) | +0 | +
| #define _BOS_NULL | +( | ++ | dest | ) | +0 | +
| #define bos_chk_err "error" | +
| #define _XSTR | +( | ++ | s | ) | +_STR(s) | +
| #define _STR | +( | ++ | s | ) | +#s | +
| #define BOS_CHK | +( | ++ | dest | ) | ++ |
| #define BOSW_CHK | +( | ++ | dest | ) | ++ |
| #define BOS_CHK2 | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOSW_CHK2 | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOS_OVR_BUTNULL | +( | ++ | dest | ) | ++ |
| #define BOSW_OVR_BUTNULL | +( | ++ | dest | ) | ++ |
| #define BOS_OVR2 | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOSW_OVR2 | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOS_OVR2Z | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOSW_OVR2Z | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOS_OVR2_BUTZERO | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOSW_OVR2_BUTZERO | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOS_OVR2_BUTNULL | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define BOSW_OVR2_BUTNULL | +( | ++ | buf, | +
| + | + | + | bufsize | +
| + | ) | ++ |
| #define VAL_OVR2 | +( | ++ | value, | +
| + | + | + | vmax | +
| + | ) | ++ |
| #define VAL_OVR2_BUTZERO | +( | ++ | value, | +
| + | + | + | vmax | +
| + | ) | ++ |
| #define BOS_NULL | +( | ++ | buf | ) | ++ |
| #define BOS_NULLPTR | +( | ++ | buf | ) | ++ |
| #define BOS_FMT | +( | ++ | fmt | ) | ++ |
| #define BOS_ATTR | +( | ++ | chk, | +
| + | + | + | msg | +
| + | ) | ++ |
| typedef void(* constraint_handler_t) (const char *restrict, void *restrict, errno_t) | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for fscanf_s.c:+Functions | |
| EXPORT int | fscanf_s (FILE *restrict stream, const char *restrict fmt,...) |
The fscanf_s function reads a formatted string from a buffered FILE stream, and writes to a list of arguments. More... | |
| EXPORT int fscanf_s | +( | +FILE *restrict | +stream, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The fscanf_s function reads a formatted string from a buffered FILE stream, and writes to a list of arguments.
| [in] | stream | pointer to a FILE stream to read from |
| [in] | fmt | format-control string. |
| [out] | ... | arguments to write to |
stream nor fmt shall be a null pointer. fmt shall not contain the conversion specifier n s is a null pointer. (not yet) c, s, and %[ conversion specifiers each expect two arguments (the usual pointer and a value of type rsize_t indicating the size of the receiving array, which may be 1 when reading with a c into a single character) and except that the following errors are detected at runtime and call the currently installed constraint handler function.EOF if read failure occurs before the first receiving argument was assigned or if there is a runtime constraint violation.| > | 0 on success, the number of arguments assigned |
| EOF | on error |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Data Structures | |
| struct | UNWIF_complist |
| struct | UNWIF_complist_s |
+Macros | |
| #define | UNWIF_COMPLIST_FIRST_LONG 0x011099 |
| #define UNWIF_COMPLIST_FIRST_LONG 0x011099 | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
+
|
+ +static | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_lib.h"
Include dependency graph for fprintf_s.c:+Functions | |
| EXPORT int | fprintf_s (FILE *restrict stream, const char *restrict fmt,...) |
| The fprintf_s function composes a string via the format string and writes it to a FILE buffer. More... | |
| EXPORT int fprintf_s | +( | +FILE *restrict | +stream, | +
| + | + | const char *restrict | +fmt, | +
| + | + | + | ... | +
| + | ) | ++ |
The fprintf_s function composes a string via the format string and writes it to a FILE buffer.
+errno is set on error. However, the safeclib extended ES* errors do not set errno, only when the underlying system vfprintf call fails, errno is set.| [out] | stream | output file stream to write to |
| [in] | fmt | format-control string. |
| [in] | ... | optional arguments |
| -ESNULLP | when stream/fmt is NULL pointer |
| -EINVAL | when fmt contains n |
| -1 | on some other error. errno is set then. |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include <unwifcmp.h>
+Data Fields | |
| uint16_t | nextchar |
| uint16_t | composite |
| uint16_t UNWIF_complist_s::nextchar | +
| uint16_t UNWIF_complist_s::composite | +
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strncat_s.c:+Functions | |
| EXPORT errno_t | _strncat_s_chk (char *restrict dest, rsize_t dmax, const char *restrict src, rsize_t slen, size_t destbos, const size_t srcbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for strcpy_s.c:+Functions | |
| EXPORT errno_t | _strcpy_s_chk (char *restrict dest, rsize_t dmax, const char *restrict src, const size_t destbos) |
| EXPORT errno_t _strcpy_s_chk | +( | +char *restrict | +dest, | +
| + | + | rsize_t | +dmax, | +
| + | + | const char *restrict | +src, | +
| + | + | const size_t | +destbos | +
| + | ) | ++ |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
#include "safe_str_lib.h"
Include dependency graph for mbsrtowcs_s.c:+Functions | |
| EXPORT errno_t | _mbsrtowcs_s_chk (size_t *restrict retvalp, wchar_t *restrict dest, rsize_t dmax, const char **restrict srcp, rsize_t len, mbstate_t *restrict ps, const size_t destbos) |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
| File in src/os | Includes file in include |
|---|---|
| asctime_s.c | safe_lib.h |
| ctime_s.c | safe_lib.h |
| getenv_s.c | safe_lib.h |
| gmtime_s.c | safe_lib.h |
| localtime_s.c | safe_lib.h |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
| File in src/misc | Includes file in include |
|---|---|
| bsearch_s.c | safe_lib.h |
| qsort_s.c | safe_lib.h |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
| File in src/mem | Includes file in include |
|---|---|
| memcpy_s.c | safe_mem_lib.h |
| memmove_s.c | safe_mem_lib.h |
| memset_s.c | safe_mem_lib.h |
| safe_mem_constraint.c | safe_mem_lib.h |
| safe_mem_constraint.h | safe_mem_lib.h |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for extmem:+Files | |
| file | memccpy_s.c |
| file | memchr_s.c |
| file | memcmp16_s.c |
| file | memcmp32_s.c |
| file | memcmp_s.c |
| file | memcpy16_s.c |
| file | memcpy32_s.c |
| file | memmove16_s.c |
| file | memmove32_s.c |
| file | memrchr_s.c |
| file | memset16_s.c |
| file | memset32_s.c |
| file | memzero16_s.c |
| file | memzero32_s.c |
| file | memzero_s.c |
| file | timingsafe_bcmp.c |
| file | timingsafe_memcmp.c |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for str:+Files | |
| file | safe_str_constraint.c |
| file | safe_str_constraint.h |
| file | snprintf_s.c |
| file | sprintf_s.c |
| file | strcat_s.c |
| file | strcpy_s.c |
| file | strerror_s.c |
| file | strerror_s.h |
| file | strncat_s.c |
| file | strncpy_s.c |
| file | strnlen_s.c |
| file | strtok_s.c |
| file | vsnprintf_s.c |
| file | vsprintf_s.c |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for extstr:+Files | |
| file | strcasecmp_s.c |
| file | strcasestr_s.c |
| file | strchr_s.c |
| file | strcmp_s.c |
| file | strcmpfld_s.c |
| file | strcoll_s.c |
| file | strcpyfld_s.c |
| file | strcpyfldin_s.c |
| file | strcpyfldout_s.c |
| file | strcspn_s.c |
| file | strfirstchar_s.c |
| file | strfirstdiff_s.c |
| file | strfirstsame_s.c |
| file | strisalphanumeric_s.c |
| file | strisascii_s.c |
| file | strisdigit_s.c |
| file | strishex_s.c |
| file | strislowercase_s.c |
| file | strismixedcase_s.c |
| file | strispassword_s.c |
| file | strisuppercase_s.c |
| file | strlastchar_s.c |
| file | strlastdiff_s.c |
| file | strlastsame_s.c |
| file | strljustify_s.c |
| file | strnatcmp_s.c |
| file | strnset_s.c |
| file | strnterminate_s.c |
| file | strpbrk_s.c |
| file | strprefix_s.c |
| file | strrchr_s.c |
| file | strremovews_s.c |
| file | strset_s.c |
| file | strspn_s.c |
| file | strstr_s.c |
| file | strtolowercase_s.c |
| file | strtouppercase_s.c |
| file | strzero_s.c |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for mem:+Files | |
| file | mem_primitives_lib.c |
| file | mem_primitives_lib.h |
| file | memcpy_s.c |
| file | memmove_s.c |
| file | memset_s.c |
| file | safe_mem_constraint.c |
| file | safe_mem_constraint.h |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for src:+Directories | |
| directory | extmem |
| directory | extstr |
| directory | extwchar |
| directory | io |
| directory | mem |
| directory | misc |
| directory | os |
| directory | slkm |
| directory | str |
| directory | wchar |
+Files | |
| file | abort_handler_s.c |
| file | ignore_handler_s.c |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for extwchar:+Files | |
| file | hangul.h |
| file | towctrans.c |
| file | towfc_s.c |
| file | unw16ifcan.h |
| file | unw16ifcmb.h |
| file | unw16ifcmp.h |
| file | unw16ifcpt.h |
| file | unw16ifexc.h |
| file | unwifcan.h |
| file | unwifcmb.h |
| file | unwifcmp.h |
| file | unwifcpt.h |
| file | unwifexc.h |
| file | wcscmp_s.c |
| file | wcscoll_s.c |
| file | wcsfc_s.c |
| file | wcsicmp_s.c |
| file | wcslwr_s.c |
| file | wcsnatcmp_s.c |
| file | wcsncmp_s.c |
| file | wcsnorm_s.c |
| file | wcsnset_s.c |
| file | wcsset_s.c |
| file | wcsstr.c |
| file | wcsstr_s.c |
| file | wcsupr_s.c |
| file | wmemcmp_s.c |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for os:+Files | |
| file | asctime_s.c |
| file | ctime_s.c |
| file | getenv_s.c |
| file | gmtime_s.c |
| file | localtime_s.c |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for io:+Files | |
| file | fopen_s.c |
| file | fprintf_s.c |
| file | freopen_s.c |
| file | fscanf_s.c |
| file | gets_s.c |
| file | printf_s.c |
| file | scanf_s.c |
| file | sscanf_s.c |
| file | tmpfile_s.c |
| file | tmpnam_s.c |
| file | vfprintf_s.c |
| file | vfscanf_s.c |
| file | vprintf_s.c |
| file | vscanf_s.c |
| file | vsscanf_s.c |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
Directory dependency graph for wchar:+Files | |
| file | fwprintf_s.c |
| file | fwscanf_s.c |
| file | mbsrtowcs_s.c |
| file | mbstowcs_s.c |
| file | snwprintf_s.c |
| file | swprintf_s.c |
| file | swscanf_s.c |
| file | vfwprintf_s.c |
| file | vfwscanf_s.c |
| file | vsnwprintf_s.c |
| file | vswprintf_s.c |
| file | vswscanf_s.c |
| file | vwprintf_s.c |
| file | vwscanf_s.c |
| file | wcrtomb_s.c |
| file | wcscat_s.c |
| file | wcscpy_s.c |
| file | wcsncat_s.c |
| file | wcsncpy_s.c |
| file | wcsnlen_s.c |
| file | wcsrtombs_s.c |
| file | wcstok_s.c |
| file | wcstombs_s.c |
| file | wctomb_s.c |
| file | wmemcpy_s.c |
| file | wmemmove_s.c |
| file | wprintf_s.c |
| file | wscanf_s.c |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
+Files | |
| file | safe_compile.h |
| file | safe_config.h |
| file | safe_lib.h |
| file | safe_lib_errno.h |
| file | safe_mem_lib.h |
| file | safe_str_lib.h |
| file | safe_types.h |
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
This page explains how to interpret the graphs that are generated by doxygen.
+Consider the following example:
This will result in the following graph:
+
+The boxes in the above graph have the following meaning:
+The arrows have the following meaning:
+|
+ safec
+ 3.4
+
+ Safe C Library - ISO TR24731 Bounds Checking Interface
+ |
+
:toc:
+This project's licensing restrictions are documented in the file 'COPYING' under the root directory of this release. Basically it's MIT licensed.
+This library implements the secure C11 Annex K functions on top of most libc implementations, which are missing from them.
+The ISO TR24731 Bounds Checking Interface documents indicate that the key motivation for the new specification is to help mitigate the ever increasing security attacks, specifically the buffer overrun.
+The rationale document says ``Buffer overrun attacks continue to be a security problem. Roughly 10% of vulnerability reports cataloged by CERT from 01/01/2005 to 07/01/2005 involved buffer overflows. Preventing buffer overruns is the primary, but not the only, motivation for this technical report.''
+The rationale document continues ``that these only mitigate, that is lessen, security problems. When used properly, these functions decrease the danger buffer overrun attacks. Source code may remain vulnerable due to other bugs and security issues. The highest level of security is achieved by building in layers of security utilizing multiple strategies.''
+.The rationale document lists the following key points for TR24731:
and the following can be added...
+The C11 Standard adopted many of these points, and added some secure _s variants in the Annex K. The Microsoft Windows/MINGW secure API did the same, but deviated in some functions from the standard. Besides Windows (with its msvcrt, ucrt, reactos msvcrt and wine msvcrt variants) only the unused stlport, Android's Bionic and Embarcadero implemented this C11 secure Annex K API so far. They are still missing from glibc, musl, FreeBSD, darwin and DragonFly libc, OpenBSD libc, newlib, dietlibc, uClibc, minilibc.
This library implements since 3.0 all functions defined in the specifications. Included in the library are extensions to the specification to provide a complementary set of functions with like behavior.
+This library is meant to be used on top of all the existing libc's which miss the secure C11 functions. Of course tighter integration into the system libc would be better, esp. with the printf, scanf and IO functions. See the seperate libc-overview document.
+Austin Group Review of ISO/IEC WDTR 24731 http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1106.txt
+C11 standard (ISO/IEC 9899:2011) http://en.cppreference.com/w/c
+Stackoverflow discussion: https://stackoverflow.com/questions/372980/do-you-use-the-tr-24731-safe-functions
+DrDobbs review http://www.drdobbs.com/cpp/the-new-c-standard-explored/232901670
+C17 reconsidered safeclib but looked only at the old incomplete Cisco version, not our complete and fixed version. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1967.htm
+The TR24731 specification says an implementation may set errno for the functions defined in the technical report, but is not required to. This library does not set errno in most functions, only in bsearch_s, fscanf_s, fwscanf_s, gets_s, gmtime_s, localtime_s, scanf_s, sscanf_s, swscanf_s, strtok_s, vfscanf_s, vfwscanf_s, vsscanf_s, vswscanf_s, wcstok_s, wscanf_s.
In most cases the safeclib extended ES* errors do not set errno, only when the underlying insecure system call fails, errno is set. The library does use errno return codes as required by functional APIs. Specific Safe C String and Safe C Memory errno codes are defined in the safe_errno.h file.
Per the spec, the library verifies that the calling program does not violate the function's runtime-constraints. If a runtime-constraint is violated, the library calls the currently registered runtime-constraint handler.
+Per the spec, multiple runtime-constraint violations in the same call to a library function result in only one call to the runtime-constraint handler. The first violation encountered invokes the runtime-constraint handler.
+With --disable-constraint-handler calling the runtime-constraint handler can be disabled, saving some memory, but not much run-time performance.
The runtime-constraint handler might not return. If the handler does return, the library function whose runtime-constraint was violated returns an indication of failure as given by the function’s return. With valid dest and dmax values, dest is cleared. With the optional --disable-null-slack only the first value of dest is cleared, otherwise the whole dest buffer.
rsize_t:: The specification defines a new type. This type, rsize_t, is conditionally defined in the safe_lib.h header file.
+RSIZE_MAX:: The specification defines the macro RSIZE_MAX which expands to a value of type rsize_t. The specification uses RSIZE_MAX for both the string functions and the memory functions. This implementation defines two macros: RSIZE_MAX_STR and RSIZE_MAX_MEM. RSIZE_MAX_STR defines the range limit for the safe string functions. RSIZE_MAX_MEM defines the range limit for the safe memory functions. The point is that string limits can and should be different from memory limits. There also exist RSIZE_MAX_WSTR, RSIZE_MAX_MEM16, RSIZE_MAX_MEM32.
+With supporting compilers the dmax overflow checks and several more are performed at compile-time. Currently only since clang-5 with diagnose_if support. This checks similar to _FORTIFY_SOURCE=2 if the __builtin_object_size of the dest buffer is the same size as dmax, and errors if dmax is too big. With the optional --enable-warn-dmax it prints a warning if the sizes are different, which is esp. practical as compile-time warning. It can be promoted via the optional --enable-error-dmax to be fatal. On unsupported compilers, the overflow check and optional equality warn-dmax check is deferred to run-time. This check is only possible with __builtin_object_size and -O2 when the dest buffer size is known at compile-time, otherwise only the simplier dest == NULL, dmax == 0 and dmax > RSIZE_MAX checks are performed.
The specification states the various functions would be added to existing Standard C header files: stdio.h, string.h, etc. This implementation separates the memory related functions into the safe_mem_lib.h header, the string related functions into the safe_str_lib.h header, and the rest into the safe_lib.h header. There are also the internal safe_compile.h, safe_config.h safe_lib_errno.h and safe_types.h headers, but they do not need to be included.
The make file builds a single library libsafec-VERSION.a and .so in the src/.libs directory. Built but not installed are also libmemprims, libsafeccore and libstdunsafe.
It is possible to split the make such that a separate safe_mem_lib.so and safe_str_lib.so are built. It is also possible to integrate the prototypes into the Standard C header files, but that may require changes to your development tool chain.
The build system for the userspace library is the well known GNU build system, a.k.a. Autotools. This system is well understood and supported by many different platforms and distributions which should allow this library to be built on a wide variety of platforms. See the xref:tested-platforms[`‘Tested Platforms’'] section for details on what platforms this library was tested on during its development.
+For those familiar with autotools you can probably skip this part. For those not and want to get right to building the code see below. And, for those that need additional information see the 'INSTALL' file in the same directory.
+.To build you do the following:
$ ./build-tools/autogen.sh +$ ./configure +$ make +
autogen.sh only needs to be run if you are building from the git repository. Optionally, you can do make check if you want to run the unit tests.
Installation must be preformed by root, an ‘Administrator’ on most systems. The following is used to install the library.
$ sudo make install +
The build for the kernel module has not been integrated into the autotools build infrastructure. Consequently, you have to run a different makefile to build the kernel module.
+.To build do the following:
$ ./configure --disable-wchar +$ make -f Makefile.kernel +
This assumes you are compiling on a Linux box and this makefile supports the standard kernel build system infrastructure documented in: <linux-kernel-src-tree>/Documentation/kbuild/modules.txt
+NOTE: If you build the kernel module then wish to build the userspace library or vice versa you will need to do a +make clean+ otherwise a +make check+ will fail to build.
+The kernel module will be found at the root of the source tree called 'slkm.ko'. The file 'testslkm.ko' are the unit tests run on the userspace library but in Linux kernel module form to verify functionality within the kernel.
+[[tested-platforms]]
.The library has been tested on the following systems:
with most available compilers. See build-tools/smoke.sh.
build-tools/autogen.sh which runs autoreconf to `‘install’' the autotools files and create the configure script.[bibliography] .References
| t |