There is no point in using SafeStringLength(str) rather than strlen(str).  If str is NULL, strcspn() already crashed.