When you run an application that calls the _sntscanf_s function, the call should return an EOF(-1) value. However, when you run the application on Windows 10 Enterprise 2015 LTSB, the injected null character is ignored. This causes the numFields field to receive an erroneous value of 1 instead of the EOF (-1) value.
For example, this issue occurs in the following Visual C++ application:
#include "stdafx.h"
#include "string.h"
#include "stdlib.h"
int main()
{
TCHAR szBuff[256];
double temp = 0;
wcscpy_s(szBuff, L"77777777");
// this should force the _sntscanf_s to return an EOF (-1) value
szBuff[0] = '\0';
int numFields = _sntscanf_s(szBuff, _countof(szBuff), _T("%lf"), &temp);
if (numFields == EOF)
{
printf("Correct Behavior!!!\r\n");
}
else
{
printf("BUG: _sntscanf_s failed to return EOF!!!\r\n");
}
return 0;
}