...
Code Block | ||
---|---|---|
| ||
static char ok_chars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "1234567890_-.@"; char user_data[] = "Bad char 1:} Bad char 2:{"; char *cp; /* cursor into string */ char const char *end = user_data + strlen( user_data); for (cp = user_data; cp != end; cp += strspn(cp, ok_chars)) { *cp = '_'; } |
...
STR01-A. Adopt and implement a consistent plan for managing strings 07. Characters and Strings (STR) STR03-A. Do not inadvertently truncate a nullNULL-terminated byte string