 
                            ...
Also, consider using the sprintf_s() function defined in ISO/IEC TR 24731-1, instead of snprintf(), to provide some additional checks. (See recommendation STR07-C. Use C11 Annex K the bounds-checking interfaces for remediation of existing string manipulation code.)
...