I suggest you use safe version of `sprintf`:
```
#ifdef _MSC_VER
sprintf_s(...);
#else
snprintf(...);
#endif
```