This project has moved. For the latest updates, please go here.


Bug in MyStrCpy


It contains the line strncpy_s(szDest, nMaxDestSize, szSrc, nMaxDestSize); which causes an invalid parameter exception, because the fourth parameter must always be strictly less than the second.

According to
strncpy_s(szDest, nMaxDestSize, szSrc, nMaxDestSize - 1); should be used.

Alternatively, the strncpy_s function could be called with _TRUNCATE, so the whole function can be simplifed to:
static void MyStrCpy(char* szDest, size_t nMaxDestSize, const char* szSrc)
    if (nMaxDestSize <= 0) {
    strncpy_s(szDest, nMaxDestSize, szSrc, _TRUNCATE);
}  // MyStrCpy
Closed Sep 14, 2014 at 7:14 PM by jkalmbach
Resolved in main-trunk


jkalmbach wrote Sep 14, 2014 at 7:13 PM

Solved in main trunk. Thanks for reporting!