3 #include "safe_str_lib.h" 4 #include "safe_str_constraint.h" 49 int sprintf_s(
char * restrict dest, rsize_t dmax,
const char * restrict fmt, ...)
53 if (dmax > RSIZE_MAX_STR) {
56 return RCNEGATE(ESLEMAX);
62 return RCNEGATE(ESNULLP);
68 return RCNEGATE(ESNULLP);
74 return RCNEGATE(ESZEROL);
79 ret = vsnprintf(dest, (
size_t)dmax, fmt, ap);
81 if (ret >= (
int)dmax) {
85 ret = RCNEGATE(ESNOSPC);
void invoke_safe_str_constraint_handler(const char *msg, void *ptr, errno_t error)
Invokes the currently set constraint handler or the default.
int sprintf_s(char *restrict dest, rsize_t dmax, const char *restrict fmt,...)
The sprintf_s function composes a string with same test that would be printed if format was used on p...