I got this wrong from Microsoft Visual Studio (before 2015 and Windows 10) where the function snprintf did not add the null character. The function _snprintf still has the behavior that it does not add the null character.
See section 'Remark' on: https://learn.microsoft.com/en-us/cpp/c-runtime-library/refe...