32 #include "safeclib_private.h" 33 #include "safe_str_constraint.h" 34 #include "safe_str_lib.h" 92 strcat_s (
char * restrict dest, rsize_t dmax,
const char * restrict src)
96 const char *overlap_bumper;
101 return RCNEGATE(ESNULLP);
107 return RCNEGATE(ESNULLP);
113 return RCNEGATE(ESZEROL);
116 if (dmax > RSIZE_MAX_STR) {
119 return RCNEGATE(ESLEMAX);
127 overlap_bumper = src;
130 while (*dest !=
'\0') {
132 if (dest == overlap_bumper) {
133 handle_error(orig_dest, orig_dmax,
"strcat_s: " 134 "overlapping objects",
136 return RCNEGATE(ESOVRLP);
142 handle_error(orig_dest, orig_dmax,
"strcat_s: " 145 return RCNEGATE(ESUNTERM);
150 if (dest == overlap_bumper) {
151 handle_error(orig_dest, orig_dmax,
"strcat_s: " 152 "overlapping objects",
154 return RCNEGATE(ESOVRLP);
159 #ifdef SAFECLIB_STR_NULL_SLACK 161 while (dmax) { *dest =
'\0'; dmax--; dest++; }
163 return RCNEGATE(EOK);
172 overlap_bumper = dest;
175 while (*dest !=
'\0') {
184 handle_error(orig_dest, orig_dmax,
"strcat_s: " 187 return RCNEGATE(ESUNTERM);
192 if (src == overlap_bumper) {
193 handle_error(orig_dest, orig_dmax,
"strcat_s: " 194 "overlapping objects",
196 return RCNEGATE(ESOVRLP);
201 #ifdef SAFECLIB_STR_NULL_SLACK 203 while (dmax) { *dest =
'\0'; dmax--; dest++; }
205 return RCNEGATE(EOK);
217 handle_error(orig_dest, orig_dmax,
"strcat_s: not enough " 221 return RCNEGATE(ESNOSPC);
errno_t strcat_s(char *restrict dest, rsize_t dmax, const char *restrict src)
The strcat_s function appends a copy of the string pointed to by src (including the terminating null ...
void invoke_safe_str_constraint_handler(const char *msg, void *ptr, errno_t error)
Invokes the currently set constraint handler or the default.