32 #include "safeclib_private.h" 33 #include "safe_str_constraint.h" 34 #include "safe_str_lib.h" 73 uint32_t cnt_lowercase;
74 uint32_t cnt_uppercase;
76 uint32_t cnt_specials;
85 if (dmax < SAFE_STR_PASSWORD_MIN_LENGTH) {
92 if (dmax > SAFE_STR_PASSWORD_MAX_LENGTH) {
103 cnt_all = cnt_lowercase = cnt_uppercase = 0;
104 cnt_numbers = cnt_specials = 0;
110 "strispassword_s: dest is unterminated",
118 if ((*dest >=
'0') && (*dest <=
'9')) {
121 }
else if ((*dest >=
'a') && (*dest <=
'z')) {
124 }
else if ((*dest >=
'A') && (*dest <=
'Z')) {
128 }
else if ((*dest >= 33) && (*dest <= 47)) {
130 }
else if ((*dest >= 58) && (*dest <= 64)) {
132 }
else if ((*dest >= 91) && (*dest <= 94)) {
134 }
else if ((*dest >= 95) && (*dest <= 96)) {
136 }
else if ((*dest >= 123) && (*dest <= 126)) {
146 if (cnt_all < SAFE_STR_PASSWORD_MAX_LENGTH &&
147 cnt_numbers >= SAFE_STR_MIN_NUMBERS &&
148 cnt_lowercase >= SAFE_STR_MIN_LOWERCASE &&
149 cnt_uppercase >= SAFE_STR_MIN_UPPERCASE &&
150 cnt_specials >= SAFE_STR_MIN_SPECIALS ) {
bool strispassword_s(const char *dest, rsize_t dmax)
This function validates the make-up of a password string.
void invoke_safe_str_constraint_handler(const char *msg, void *ptr, errno_t error)
Invokes the currently set constraint handler or the default.