증상
_Sntscanf_s 함수를 호출 하는 응용 프로그램을 실행 하면 호출 된 EOF(-1) 값을 반환 해야 합니다. 그러나 10 기업 2015 LTSB Windows에서 응용 프로그램을 실행 하는 경우 삽입 된 null 문자는 무시 됩니다. 이렇게 하면 numFields 필드 1EOF (-1) 값이 아닌 잘못 된 값을 받을 수 있습니다.
예를 들어, 다음 Visual C++ 응용 프로그램에 이러한 문제가 발생 합니다.
#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;
}
원인
10 기업 2015 LTSB Windows에에서 포함 되어 있는 Ucrtbase.dll 파일에는 common_vsscanf 함수에서 알려진된 문제로 인해이 문제가 발생 합니다. 이 문제는 전체 scanf 계열의 함수 영향을 줍니다.
-
_vsscanf_l
-
vsscanf
-
_sscanf_l
-
sscanf
-
_vsscanf_s_l
-
vsscanf_s
-
_sscanfs_l
-
sscanf_s
-
_snscanf_l
-
_snscanf_s
-
_snscanf_s_l
-
_snscanf_s
-
_vswscanf_l
-
vswscanf
-
_swscanf_l
-
swscanf
-
_vswscanf_s_l
-
vswscanf_s
-
_wsscanfs_l
-
swscanf_s
-
_snwscanf_l
-
_snwscanf_s
-
_snwscanf_s_l
-
_snwscanf_s
해결 방법
이 문제를 해결 하려면 업데이트 설치 서비스 2018, 5 월 8-KB4103716 (OS 빌드 10240.17861).