diff options
author | Eugene Zemtsov <Eugene.Zemtsov@microsoft.com> | 2015-04-27 21:21:49 -0700 |
---|---|---|
committer | Eugene Zemtsov <Eugene.Zemtsov@microsoft.com> | 2015-04-27 21:21:49 -0700 |
commit | 66c9e347d985c3d92d818322a928ffb165c973df (patch) | |
tree | a9b0c528b5f890915dd5a17b08e4266900f0f72a /src/pal/inc/rt | |
parent | 890ee7cf30980cd9f0205872b7cffc19a8ca803c (diff) | |
download | coreclr-66c9e347d985c3d92d818322a928ffb165c973df.tar.gz coreclr-66c9e347d985c3d92d818322a928ffb165c973df.tar.bz2 coreclr-66c9e347d985c3d92d818322a928ffb165c973df.zip |
Get rid of *scanf_unsafe function which do nothing useful and incorrectly pass arguments to real scanf functions
Diffstat (limited to 'src/pal/inc/rt')
-rw-r--r-- | src/pal/inc/rt/palrt.h | 75 |
1 files changed, 2 insertions, 73 deletions
diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h index 10e9f13400..1d6344d969 100644 --- a/src/pal/inc/rt/palrt.h +++ b/src/pal/inc/rt/palrt.h @@ -878,8 +878,8 @@ Remember to fix the errcode defintion in safecrt.h. #define _vsnwprintf_s _vsnwprintf_unsafe #define _snprintf_s _snprintf_unsafe #define _vsnprintf_s _vsnprintf_unsafe -#define swscanf_s _swscanf_unsafe -#define sscanf_s _sscanf_unsafe +#define swscanf_s swscanf +#define sscanf_s sscanf #define _wfopen_s _wfopen_unsafe #define fopen_s _fopen_unsafe @@ -1022,77 +1022,6 @@ inline int __cdecl _snprintf_unsafe(char *_Dst, size_t _SizeInWords, size_t _Cou return ret; } -inline int __cdecl _swscanf_unsafe(const wchar_t *_Dst, const wchar_t *_Format,...) -{ - int ret; - va_list _ArgList; - va_start(_ArgList, _Format); - wchar_t *tempFormat; - - tempFormat = (wchar_t*) _Format; - - while (*tempFormat != L'\0') { - - if (*tempFormat == L'%') { - - // - // If scanf takes parameters other than numbers, return error. - // - - if (! ((*(tempFormat+1)==L'x') || (*(tempFormat+1)==L'd') || - (*(tempFormat+1)==L'X') || (*(tempFormat+1)==L'D')) ) { - - _ASSERTE(FALSE); - return -1; - - } - } - - tempFormat++; - } - - ret = swscanf(_Dst, _Format, _ArgList); - va_end(_ArgList); - return ret; -} - -inline int __cdecl _sscanf_unsafe(const char *_Dst, const char *_Format,...) -{ - int ret; - char *tempFormat; - - va_list _ArgList; - va_start(_ArgList, _Format); - - tempFormat = (char*) _Format; - - while (*tempFormat != '\0') { - - if (*tempFormat == '%') { - - // - // If scanf takes parameters other than numbers, return error. - // - - if (! ((*(tempFormat+1)=='x') || (*(tempFormat+1)=='d') || - (*(tempFormat+1)=='X') || (*(tempFormat+1)=='D')) ) { - - _ASSERTE(FALSE); - return -1; - - } - } - - tempFormat++; - } - - - ret = sscanf(_Dst, _Format, _ArgList); - va_end(_ArgList); - - return ret; -} - inline errno_t __cdecl _wfopen_unsafe(FILE * *ff, const wchar_t *fileName, const wchar_t *mode) { FILE *result = _wfopen(fileName, mode); |