Replace functions with secured version for OSX compliance (#7586)
* replace strlen with strnlen
* replace vsnprintf with vsnprintf_l
* add macro
* switch to std numeric::limits
* apply uint16 max
* fix build err
* fix mac build
* define MAX_STR_LEN
* define MAX_STR_LEN
* fix typo
* trim empty lines
* apply constexpr
* fix typo
* add namespace
* fix build err
* rename global constant
Co-authored-by: Randy <Randy@randysmac.attlocal.net>
Co-authored-by: Randy Shuai <rashuai@microsoft.com>
Co-authored-by: Randy <Randy@randysmac.local>