Simptomi
Kada pokrenete aplikaciju koja poziva funkciju _sntscanf_s , poziv treba da vrati EOF(-1) vrednost. Međutim, kada pokrenete aplikaciju u operativnom sistemu Windows 10 Enterprise 2015 LTSB, ubačeni znak "null" se zanemaruje. Zbog toga polje numFields prima pogrešnu vrednost 1 umesto vrednosti EOF (-1).
Na primer, do ovog problema dolazi u sledećoj Visual C++ aplikaciji:
#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;
}
Uzrok
Do ovog problema dolazi zbog poznatog problema u funkciji common_vsscanf u datoteci Ucrtbase.dll koja je uključena u Windows 10 Enterprise 2015 LTSB. Ovaj problem utiče na celu porodicu funkcija skeniranja :
- _vsscanf_l
- Srpskohrvatski / srpskohrvatski
- _sscanf_l
- OMILjENO
- _vsscanf_s_l
- vsscanf_s
- _sscanfs_l
- sscanf_s
- _snscanf_l
- _snscanf_s
- _snscanf_s_l
- _snscanf_s
- _vswscanf_l
- Srpskohrvatski / srpskohrvatski
- _swscanf_l
- Srpsko-hrvatski
- _vswscanf_s_l
- vswscanf_s
- _wsscanfs_l
- swscanf_s
- _snwscanf_l
- _snwscanf_s
- _snwscanf_s_l
- _snwscanf_s
Rešenje
Da biste rešili ovaj problem, instalirajte ispravku za servisiranje 8. maj 2018. – KB4103716 (OS izdanje 10240.17861).