From e58e3c5e0a527802bd5286c537dc3ed603317c1d Mon Sep 17 00:00:00 2001 From: Jan Vorlicek Date: Fri, 9 Dec 2016 00:51:19 +0100 Subject: [PATCH] Remove sscanf and sprintf usage (#8508) * Remove sscanf * Remove sprintf --- .../superpmi/superpmi-shared/mclist.cpp | 2 +- .../superpmi/superpmi/methodstatsemitter.cpp | 22 +++--- .../superpmi/superpmi/parallelsuperpmi.cpp | 6 +- src/debug/ee/debugger.cpp | 8 +-- src/dlls/mscordac/mscordac_unixexports.src | 1 + src/ilasm/prebuilt/asmparse.cpp | 2 +- src/ildasm/dis.cpp | 6 +- src/ildasm/dres.cpp | 4 +- src/ildasm/gui.cpp | 2 +- src/jit/codegenarm.cpp | 3 +- src/jit/codegenarm64.cpp | 3 +- src/jit/codegenxarch.cpp | 3 +- src/jit/inlinepolicy.cpp | 12 ++-- src/jit/utils.cpp | 2 +- src/pal/inc/pal.h | 5 +- src/pal/inc/rt/palrt.h | 1 - src/pal/src/CMakeLists.txt | 4 +- src/pal/src/cruntime/printf.cpp | 57 --------------- src/pal/src/debug/debug.cpp | 2 +- src/pal/src/exception/machmessage.h | 2 +- src/pal/src/include/pal/palinternal.h | 2 - src/pal/src/safecrt/input.inl | 4 +- src/pal/src/safecrt/mbusafecrt.cpp | 7 +- .../safecrt/{sprintf.cpp => sprintf_s.cpp} | 2 +- .../src/safecrt/{sscanf.cpp => sscanf_s.cpp} | 2 +- src/pal/src/thread/process.cpp | 10 +-- .../tests/palsuite/c_runtime/CMakeLists.txt | 4 +- .../c_runtime/sprintf/test5/CMakeLists.txt | 19 ----- .../c_runtime/sprintf/test5/test5.cpp | 62 ---------------- .../c_runtime/sprintf/test5/testinfo.dat | 12 ---- .../{sprintf => sprintf_s}/CMakeLists.txt | 1 - .../sprintf.h => sprintf_s/sprintf_s.h} | 32 ++++----- .../test1/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test1/test1.cpp | 6 +- .../{sprintf => sprintf_s}/test1/testinfo.dat | 6 +- .../test10/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test10/test10.cpp | 4 +- .../test10/testinfo.dat | 6 +- .../test11/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test11/test11.cpp | 4 +- .../test11/testinfo.dat | 6 +- .../test12/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test12/test12.cpp | 4 +- .../test12/testinfo.dat | 6 +- .../test13/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test13/test13.cpp | 4 +- .../{sscanf => sprintf_s}/test13/testinfo.dat | 6 +- .../test14/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test14/test14.cpp | 4 +- .../{sscanf => sprintf_s}/test14/testinfo.dat | 6 +- .../test15/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test15/test15.cpp | 4 +- .../{sscanf => sprintf_s}/test15/testinfo.dat | 6 +- .../test16/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test16/test16.cpp | 4 +- .../test16/testinfo.dat | 6 +- .../test17/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test17/test17.cpp | 4 +- .../{sscanf => sprintf_s}/test17/testinfo.dat | 6 +- .../test18/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test18/test18.cpp | 4 +- .../test18/testinfo.dat | 6 +- .../test19/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test19/test19.cpp | 11 +-- .../test19/testinfo.dat | 6 +- .../test2/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test2/test2.cpp | 4 +- .../{sprintf => sprintf_s}/test2/testinfo.dat | 6 +- .../test3/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test3/test3.cpp | 4 +- .../{sscanf => sprintf_s}/test3/testinfo.dat | 6 +- .../test4/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test4/test4.cpp | 4 +- .../{sscanf => sprintf_s}/test4/testinfo.dat | 6 +- .../test6/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test6/test6.cpp | 4 +- .../{sprintf => sprintf_s}/test6/testinfo.dat | 6 +- .../test7/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test7/test7.cpp | 4 +- .../{sprintf => sprintf_s}/test7/testinfo.dat | 6 +- .../test8/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test8/test8.cpp | 4 +- .../{sscanf => sprintf_s}/test8/testinfo.dat | 6 +- .../test9/CMakeLists.txt | 0 .../{sprintf => sprintf_s}/test9/test9.cpp | 4 +- .../{sprintf => sprintf_s}/test9/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/CMakeLists.txt | 0 .../{sscanf/sscanf.h => sscanf_s/sscanf_s.h} | 48 ++++++------- .../{sscanf => sscanf_s}/test1/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test1/test1.cpp | 6 +- .../{sscanf => sscanf_s}/test1/testinfo.dat | 6 +- .../test10/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test10/test10.cpp | 4 +- .../{sscanf => sscanf_s}/test10/testinfo.dat | 6 +- .../test11/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test11/test11.cpp | 4 +- .../{sscanf => sscanf_s}/test11/testinfo.dat | 6 +- .../test12/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test12/test12.cpp | 4 +- .../{sscanf => sscanf_s}/test12/testinfo.dat | 6 +- .../test13/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test13/test13.cpp | 4 +- .../{sprintf => sscanf_s}/test13/testinfo.dat | 6 +- .../test14/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test14/test14.cpp | 4 +- .../{sprintf => sscanf_s}/test14/testinfo.dat | 6 +- .../test15/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test15/test15.cpp | 4 +- .../{sprintf => sscanf_s}/test15/testinfo.dat | 6 +- .../test16/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test16/test16.cpp | 4 +- .../{sscanf => sscanf_s}/test16/testinfo.dat | 6 +- .../test17/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test17/test17.cpp | 4 +- .../{sprintf => sscanf_s}/test17/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/test2/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test2/test2.cpp | 4 +- .../{sscanf => sscanf_s}/test2/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/test3/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test3/test3.cpp | 4 +- .../{sprintf => sscanf_s}/test3/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/test4/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test4/test4.cpp | 4 +- .../{sprintf => sscanf_s}/test4/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/test5/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test5/test5.cpp | 4 +- .../{sscanf => sscanf_s}/test5/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/test6/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test6/test6.cpp | 4 +- .../{sscanf => sscanf_s}/test6/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/test7/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test7/test7.cpp | 4 +- .../{sscanf => sscanf_s}/test7/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/test8/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test8/test8.cpp | 4 +- .../{sprintf => sscanf_s}/test8/testinfo.dat | 6 +- .../{sscanf => sscanf_s}/test9/CMakeLists.txt | 0 .../{sscanf => sscanf_s}/test9/test9.cpp | 4 +- .../{sscanf => sscanf_s}/test9/testinfo.dat | 6 +- .../palsuite/c_runtime/swscanf/swscanf.h | 4 +- .../palsuite/c_runtime/wcscat/test1/test1.cpp | 4 +- .../palsuite/c_runtime/wcscpy/test1/test1.cpp | 4 +- src/pal/tests/palsuite/common/palsuite.h | 2 +- .../WriteProcessMemory/test1/test1.cpp | 2 +- .../WriteProcessMemory/test3/test3.cpp | 2 +- .../test1/CreateDirectoryA.cpp | 2 +- .../test1/CreateDirectoryW.cpp | 2 +- .../file_io/CreateFileA/test1/CreateFileA.cpp | 4 +- .../file_io/CreateFileW/test1/CreateFileW.cpp | 4 +- .../test1/GetTempFileNameA.cpp | 2 +- .../file_io/MoveFileA/test1/MoveFileA.cpp | 28 ++++---- .../file_io/MoveFileW/test1/MoveFileW.cpp | 28 ++++---- .../test1/RemoveDirectoryA.cpp | 12 ++-- .../test1/RemoveDirectoryW.cpp | 4 +- .../file_io/SearchPathA/test1/SearchPathA.cpp | 2 +- .../file_io/SearchPathW/test1/SearchPathW.cpp | 2 +- .../test1/SetCurrentDirectoryA.cpp | 4 +- .../test2/setcurrentdirectorya.cpp | 4 +- .../test2/setcurrentdirectoryw.cpp | 4 +- .../test2/CreateFileMappingW.cpp | 4 +- .../ReadProcessMemory/test2/test2.cpp | 4 +- .../LoadLibraryA/test5/loadlibrarya.cpp | 4 +- .../LoadLibraryW/test5/loadlibraryw.cpp | 4 +- ...AL_RegisterLibraryW_UnregisterLibraryW.cpp | 2 +- .../test2_neg/reg_unreg_libraryw_neg.cpp | 2 +- src/pal/tests/palsuite/paltestlist.txt | 71 +++++++++---------- src/pal/tests/palsuite/palverify.dat | 71 +++++++++---------- src/vm/appdomain.cpp | 6 +- src/vm/compile.cpp | 2 +- src/vm/gdbjit.cpp | 11 +-- 170 files changed, 425 insertions(+), 589 deletions(-) rename src/pal/src/safecrt/{sprintf.cpp => sprintf_s.cpp} (98%) rename src/pal/src/safecrt/{sscanf.cpp => sscanf_s.cpp} (99%) delete mode 100644 src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.cpp delete mode 100644 src/pal/tests/palsuite/c_runtime/sprintf/test5/testinfo.dat rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/CMakeLists.txt (95%) rename src/pal/tests/palsuite/c_runtime/{sprintf/sprintf.h => sprintf_s/sprintf_s.h} (86%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test1/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test1/test1.cpp (85%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test1/testinfo.dat (71%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test10/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test10/test10.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test10/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test11/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test11/test11.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test11/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test12/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test12/test12.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test12/testinfo.dat (72%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test13/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test13/test13.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sprintf_s}/test13/testinfo.dat (72%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test14/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test14/test14.cpp (95%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sprintf_s}/test14/testinfo.dat (70%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test15/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test15/test15.cpp (95%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sprintf_s}/test15/testinfo.dat (70%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test16/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test16/test16.cpp (94%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test16/testinfo.dat (71%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test17/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test17/test17.cpp (94%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sprintf_s}/test17/testinfo.dat (70%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test18/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test18/test18.cpp (94%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test18/testinfo.dat (70%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test19/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test19/test19.cpp (90%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test19/testinfo.dat (71%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test2/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test2/test2.cpp (91%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test2/testinfo.dat (75%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test3/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test3/test3.cpp (92%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sprintf_s}/test3/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test4/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test4/test4.cpp (96%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sprintf_s}/test4/testinfo.dat (75%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test6/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test6/test6.cpp (91%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test6/testinfo.dat (75%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test7/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test7/test7.cpp (92%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test7/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test8/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test8/test8.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sprintf_s}/test8/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test9/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test9/test9.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sprintf_s}/test9/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf/sscanf.h => sscanf_s/sscanf_s.h} (80%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test1/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test1/test1.cpp (91%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test1/testinfo.dat (77%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test10/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test10/test10.cpp (92%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test10/testinfo.dat (75%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test11/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test11/test11.cpp (92%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test11/testinfo.dat (76%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test12/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test12/test12.cpp (92%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test12/testinfo.dat (75%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test13/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test13/test13.cpp (91%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sscanf_s}/test13/testinfo.dat (73%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test14/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test14/test14.cpp (89%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sscanf_s}/test14/testinfo.dat (70%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test15/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test15/test15.cpp (90%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sscanf_s}/test15/testinfo.dat (70%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test16/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test16/test16.cpp (90%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test16/testinfo.dat (70%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test17/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test17/test17.cpp (90%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sscanf_s}/test17/testinfo.dat (70%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test2/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test2/test2.cpp (92%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test2/testinfo.dat (71%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test3/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test3/test3.cpp (91%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sscanf_s}/test3/testinfo.dat (73%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test4/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test4/test4.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sscanf_s}/test4/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test5/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test5/test5.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test5/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test6/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test6/test6.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test6/testinfo.dat (75%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test7/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test7/test7.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test7/testinfo.dat (73%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test8/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test8/test8.cpp (93%) rename src/pal/tests/palsuite/c_runtime/{sprintf => sscanf_s}/test8/testinfo.dat (74%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test9/CMakeLists.txt (100%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test9/test9.cpp (92%) rename src/pal/tests/palsuite/c_runtime/{sscanf => sscanf_s}/test9/testinfo.dat (75%) diff --git a/src/ToolBox/superpmi/superpmi-shared/mclist.cpp b/src/ToolBox/superpmi/superpmi-shared/mclist.cpp index 6a6f8701bf..511893fc96 100644 --- a/src/ToolBox/superpmi/superpmi-shared/mclist.cpp +++ b/src/ToolBox/superpmi/superpmi-shared/mclist.cpp @@ -237,7 +237,7 @@ void MCList::AddMethodToMCL(int methodIndex) DWORD charCount = 0; DWORD bytesWritten = 0; - charCount = sprintf(strMethodIndex, "%d\r\n", methodIndex); + charCount = sprintf_s(strMethodIndex, sizeof(strMethodIndex), "%d\r\n", methodIndex); if (!WriteFile(hMCLFile, strMethodIndex, charCount, &bytesWritten, nullptr) || bytesWritten != charCount) { diff --git a/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp b/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp index 0a43f02dd9..5cebc97db4 100644 --- a/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp +++ b/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp @@ -50,11 +50,11 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir if (mc->dumpMethodMD5HashToBuffer(md5Hash, MD5_HASH_BUFFER_SIZE) != MD5_HASH_BUFFER_SIZE) md5Hash[0] = 0; - charCount += sprintf(rowData + charCount, "%s,", md5Hash); + charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%s,", md5Hash); } if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'n') != NULL || strchr(statsTypes, 'N') != NULL) { - charCount += sprintf(rowData + charCount, "%d,", methodNumber); + charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", methodNumber); } if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'i') != NULL || strchr(statsTypes, 'I') != NULL) { @@ -63,7 +63,7 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir unsigned flags = 0; mc->repCompileMethod(&info, &flags); - charCount += sprintf(rowData + charCount, "%d,", info.ILCodeSize); + charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", info.ILCodeSize); } if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'a') != NULL || strchr(statsTypes, 'A') != NULL) { @@ -76,11 +76,11 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir else codeSize = 0;//this is likely a thin mc - charCount += sprintf(rowData + charCount, "%d,", codeSize); + charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", codeSize); } if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 't') != NULL || strchr(statsTypes, 'T') != NULL) { - charCount += sprintf(rowData + charCount, "%llu,%llu,", firstTime, secondTime); + charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%llu,%llu,", firstTime, secondTime); } //get rid of the final ',' and replace it with a '\n' @@ -105,15 +105,15 @@ void MethodStatsEmitter::SetStatsTypes(char *types) DWORD bytesWritten = 0; if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'h') != NULL || strchr(statsTypes, 'H') != NULL) - charCount += sprintf(rowHeader + charCount, "HASH,"); + charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "HASH,"); if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'n') != NULL || strchr(statsTypes, 'N') != NULL) - charCount += sprintf(rowHeader + charCount, "METHOD_NUMBER,"); + charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "METHOD_NUMBER,"); if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'i') != NULL || strchr(statsTypes, 'I') != NULL) - charCount += sprintf(rowHeader + charCount, "IL_CODE_SIZE,"); + charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "IL_CODE_SIZE,"); if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'a') != NULL || strchr(statsTypes, 'A') != NULL) - charCount += sprintf(rowHeader + charCount, "ASM_CODE_SIZE,"); + charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "ASM_CODE_SIZE,"); if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 't') != NULL || strchr(statsTypes, 'T') != NULL) - charCount += sprintf(rowHeader + charCount, "Time1,Time2,"); + charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "Time1,Time2,"); //get rid of the final ',' and replace it with a '\n' rowHeader[charCount - 1] = '\n'; @@ -123,4 +123,4 @@ void MethodStatsEmitter::SetStatsTypes(char *types) LogError("Failed to write row header '%s'. GetLastError()=%u", rowHeader, GetLastError()); } } -} \ No newline at end of file +} diff --git a/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp b/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp index 8c5232315e..301db3cfe9 100644 --- a/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp +++ b/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp @@ -138,7 +138,7 @@ bool WriteArrayToMCL(char *mclFilename, int *arr, int count) DWORD charCount = 0; DWORD bytesWritten = 0; - charCount = sprintf(strMethodIndex, "%d\r\n", arr[i]); + charCount = sprintf_s(strMethodIndex, sizeof(strMethodIndex), "%d\r\n", arr[i]); if (!WriteFile(hMCLFile, strMethodIndex, charCount, &bytesWritten, nullptr) || (bytesWritten != charCount)) { @@ -232,7 +232,7 @@ void ProcessChildStdOut(const CommandLine::Options& o, char *stdoutFilename, int if (o.applyDiff) { int temp1 = 0, temp2 = 0, temp3 = 0, temp4 = 0; - int converted = sscanf(buff, g_AsmDiffsSummaryFormatString, &temp1, &temp2, &temp3, &temp4); + int converted = sscanf_s(buff, g_AsmDiffsSummaryFormatString, &temp1, &temp2, &temp3, &temp4); if (converted != 4) { LogError("Couldn't parse status message: \"%s\"", buff); @@ -248,7 +248,7 @@ void ProcessChildStdOut(const CommandLine::Options& o, char *stdoutFilename, int else { int temp1 = 0, temp2 = 0, temp3 = 0; - int converted = sscanf(buff, g_SummaryFormatString, &temp1, &temp2, &temp3); + int converted = sscanf_s(buff, g_SummaryFormatString, &temp1, &temp2, &temp3); if (converted != 3) { LogError("Couldn't parse status message: \"%s\"", buff); diff --git a/src/debug/ee/debugger.cpp b/src/debug/ee/debugger.cpp index 43a2e56943..2aed8bd820 100644 --- a/src/debug/ee/debugger.cpp +++ b/src/debug/ee/debugger.cpp @@ -597,8 +597,8 @@ void DoAssertOnType(DebuggerIPCEventType event, int count) if (g_iDbgRuntimeCounter[event & 0x00ff] == count) { char tmpStr[256]; - sprintf(tmpStr, "%s == %d, break now!", - IPCENames::GetName(event), count); + _snprintf_s(tmpStr, _countof(tmpStr), _TRUNCATE, "%s == %d, break now!", + IPCENames::GetName(event), count); // fire the assertion DbgAssertDialog(__FILE__, __LINE__, tmpStr); @@ -611,8 +611,8 @@ void DoAssertOnType(DebuggerIPCEventType event, int count) if (g_iDbgDebuggerCounter[event & 0x00ff] == count) { char tmpStr[256]; - sprintf(tmpStr, "%s == %d, break now!", - IPCENames::GetName(event), count); + _snprintf_s(tmpStr, _countof(tmpStr), _TRUNCATE, "%s == %d, break now!", + IPCENames::GetName(event), count); // fire the assertion DbgAssertDialog(__FILE__, __LINE__, tmpStr); diff --git a/src/dlls/mscordac/mscordac_unixexports.src b/src/dlls/mscordac/mscordac_unixexports.src index aa0b541bd2..ffa596833f 100644 --- a/src/dlls/mscordac/mscordac_unixexports.src +++ b/src/dlls/mscordac/mscordac_unixexports.src @@ -57,6 +57,7 @@ _vsnwprintf_s _itow_s _i64tow_s memcpy_s +sscanf_s CoCreateGuid CopyFileW diff --git a/src/ilasm/prebuilt/asmparse.cpp b/src/ilasm/prebuilt/asmparse.cpp index 71b31a5ed6..50c62030ff 100644 --- a/src/ilasm/prebuilt/asmparse.cpp +++ b/src/ilasm/prebuilt/asmparse.cpp @@ -1744,7 +1744,7 @@ YYSTATIC YYCONST short yyrecover[] = { #define YYAPI_TOKENTYPE int #define YYAPI_TOKENEME(t) (t) #define YYAPI_TOKENNONE -1 -#define YYAPI_TOKENSTR(t) (sprintf(yytokbuf, "%d", t), yytokbuf) +#define YYAPI_TOKENSTR(t) (sprintf_s(yytokbuf, _countof(yytokbuf), "%d", t), yytokbuf) #define YYAPI_VALUENAME yylval #define YYAPI_VALUETYPE YYSTYPE #define YYAPI_VALUEOF(v) (v) diff --git a/src/ildasm/dis.cpp b/src/ildasm/dis.cpp index ad5e5a7141..371466feee 100644 --- a/src/ildasm/dis.cpp +++ b/src/ildasm/dis.cpp @@ -475,7 +475,7 @@ void dumpOneEHInfo(DasmExceptionInfoClause* ehInfo, IMDInternalImport *pImport, /* if(ehInfo->GetFlags() & ERR_OUT_OF_CODE) { - sprintf(szString,"%s// WARNING: Boundary outside the method code",g_szAsmCodeIndent); + _snprintf_s(szString, _countof(szString), _TRUNCATE, "%s// WARNING: Boundary outside the method code",g_szAsmCodeIndent); printLine(GUICookie,szString); } */ @@ -863,8 +863,8 @@ BOOL SourceLinesHelper(void *GUICookie, LineCodeDescr* pLCD, __out_ecount(nSize) /* BOOL fHasEmbeddedSource=FALSE; ((ISymUnmanagedDocument*)(pParam->pLCD->FileToken))->HasEmbeddedSource(&fHasEmbeddedSource); - sprintf(szString,"%s// PDB has %sembedded source",g_szAsmCodeIndent, - fHasEmbeddedSource ? "" : "no "); + _snprintf_s(szString, _countof(szString), _TRUNCATE, "%s// PDB has %sembedded source",g_szAsmCodeIndent, + fHasEmbeddedSource ? "" : "no "); printLine(pParam->GUICookie,szString); */ } diff --git a/src/ildasm/dres.cpp b/src/ildasm/dres.cpp index 0f23fcc036..53e1925cea 100644 --- a/src/ildasm/dres.cpp +++ b/src/ildasm/dres.cpp @@ -281,11 +281,11 @@ DWORD DumpResourceToFile(__in __nullterminated WCHAR* wzFileName) void* GUICookie = (void*)wzFileName; BYTE* pbData; printLine(GUICookie,""); - sprintf(szString,"// ========== Win32 Resource Entries (%d) ========",ulNumResNodes); + sprintf_s(szString, _countof(szString), "// ========== Win32 Resource Entries (%d) ========",ulNumResNodes); for(i=0; i < ulNumResNodes; i++) { printLine(GUICookie,""); - sprintf(szString,"// Res.# %d Type=0x%X Name=0x%X Lang=0x%X DataOffset=0x%X DataLength=%d", + sprintf_s(szString, _countof(szString), "// Res.# %d Type=0x%X Name=0x%X Lang=0x%X DataOffset=0x%X DataLength=%d", i+1, g_prResNodePtr[i]->ResHdr.dwTypeID, g_prResNodePtr[i]->ResHdr.dwNameID, diff --git a/src/ildasm/gui.cpp b/src/ildasm/gui.cpp index f5f141d279..83501e66ef 100644 --- a/src/ildasm/gui.cpp +++ b/src/ildasm/gui.cpp @@ -2256,7 +2256,7 @@ void FindTextInListbox(HWND hwnd, FINDREPLACEW* lpfr) if(pos >= 0) { //char sz[32]; - //sprintf(sz,"%d:%d",strFind.chrg.cpMin,strFind.chrg.cpMax); + //sprintf_s(sz, _countof(sz), "%d:%d",strFind.chrg.cpMin,strFind.chrg.cpMax); //MessageBox(hwnd,sz,"Find",MB_OK); SendMessage(hwndLB,EM_SETSEL,(WPARAM)pos,(LPARAM)(pos+wcslen(lpfr->lpstrFindWhat))); } diff --git a/src/jit/codegenarm.cpp b/src/jit/codegenarm.cpp index 057521f1d6..076fb0fb67 100644 --- a/src/jit/codegenarm.cpp +++ b/src/jit/codegenarm.cpp @@ -737,7 +737,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode) { #ifdef DEBUG char message[256]; - sprintf(message, "NYI: Unimplemented node type %s\n", GenTree::NodeName(treeNode->OperGet())); + _snprintf_s(message, _countof(message), _TRUNCATE, "NYI: Unimplemented node type %s\n", + GenTree::NodeName(treeNode->OperGet())); notYetImplemented(message, __FILE__, __LINE__); #else NYI("unimplemented node"); diff --git a/src/jit/codegenarm64.cpp b/src/jit/codegenarm64.cpp index 5220ebcaa4..65477faca8 100644 --- a/src/jit/codegenarm64.cpp +++ b/src/jit/codegenarm64.cpp @@ -2896,7 +2896,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode) { #ifdef DEBUG char message[256]; - sprintf(message, "Unimplemented node type %s\n", GenTree::NodeName(treeNode->OperGet())); + _snprintf_s(message, _countof(message), _TRUNCATE, "Unimplemented node type %s\n", + GenTree::NodeName(treeNode->OperGet())); #endif assert(!"Unknown node in codegen"); } diff --git a/src/jit/codegenxarch.cpp b/src/jit/codegenxarch.cpp index ab0bc3ac5b..1adefc12c9 100644 --- a/src/jit/codegenxarch.cpp +++ b/src/jit/codegenxarch.cpp @@ -2193,7 +2193,8 @@ void CodeGen::genCodeForTreeNode(GenTreePtr treeNode) { #ifdef DEBUG char message[256]; - sprintf(message, "Unimplemented node type %s\n", GenTree::NodeName(treeNode->OperGet())); + _snprintf_s(message, _countof(message), _TRUNCATE, "Unimplemented node type %s\n", + GenTree::NodeName(treeNode->OperGet())); #endif assert(!"Unknown node in codegen"); } diff --git a/src/jit/inlinepolicy.cpp b/src/jit/inlinepolicy.cpp index c7b0e91cc6..61e70c3ed4 100644 --- a/src/jit/inlinepolicy.cpp +++ b/src/jit/inlinepolicy.cpp @@ -2463,7 +2463,7 @@ bool ReplayPolicy::FindMethod() // See if token matches unsigned token = 0; - int count = sscanf(buffer, " %u ", &token); + int count = sscanf_s(buffer, " %u ", &token); if ((count != 1) || (token != methodToken)) { continue; @@ -2477,7 +2477,7 @@ bool ReplayPolicy::FindMethod() // See if hash matches unsigned hash = 0; - count = sscanf(buffer, " %u ", &hash); + count = sscanf_s(buffer, " %u ", &hash); if ((count != 1) || (hash != methodHash)) { continue; @@ -2636,7 +2636,7 @@ bool ReplayPolicy::FindInline(unsigned token, unsigned hash, unsigned offset) // Match token unsigned inlineToken = 0; - int count = sscanf(buffer, " %u ", &inlineToken); + int count = sscanf_s(buffer, " %u ", &inlineToken); if ((count != 1) || (inlineToken != token)) { @@ -2651,7 +2651,7 @@ bool ReplayPolicy::FindInline(unsigned token, unsigned hash, unsigned offset) // Match hash unsigned inlineHash = 0; - count = sscanf(buffer, " %u ", &inlineHash); + count = sscanf_s(buffer, " %u ", &inlineHash); if ((count != 1) || (inlineHash != hash)) { @@ -2666,7 +2666,7 @@ bool ReplayPolicy::FindInline(unsigned token, unsigned hash, unsigned offset) // Match offset unsigned inlineOffset = 0; - count = sscanf(buffer, " %u ", &inlineOffset); + count = sscanf_s(buffer, " %u ", &inlineOffset); if ((count != 1) || (inlineOffset != offset)) { continue; @@ -2685,7 +2685,7 @@ bool ReplayPolicy::FindInline(unsigned token, unsigned hash, unsigned offset) if (fgets(buffer, sizeof(buffer), s_ReplayFile) != nullptr) { unsigned collectData = 0; - count = sscanf(buffer, " %u ", &collectData); + count = sscanf_s(buffer, " %u ", &collectData); if (count == 1) { diff --git a/src/jit/utils.cpp b/src/jit/utils.cpp index 6b62cb7fb7..3a45039aa7 100644 --- a/src/jit/utils.cpp +++ b/src/jit/utils.cpp @@ -657,7 +657,7 @@ void dumpILRange(const BYTE* const codeAddr, unsigned codeSize) // in bytes for (IL_OFFSET offs = 0; offs < codeSize;) { char prefix[100]; - sprintf(prefix, "IL_%04x ", offs); + sprintf_s(prefix, _countof(prefix), "IL_%04x ", offs); unsigned codeBytesDumped = dumpSingleInstr(codeAddr, offs, prefix); offs += codeBytesDumped; } diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index ba3cb245f3..28c6278ece 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -5679,9 +5679,7 @@ CoCreateGuid(OUT GUID * pguid); #define printf PAL_printf #define vprintf PAL_vprintf #define wprintf PAL_wprintf -#define sprintf PAL_sprintf #define swprintf PAL_swprintf -#define sscanf PAL_sscanf #define wcsspn PAL_wcsspn #define wcstod PAL_wcstod #define wcstol PAL_wcstol @@ -5850,9 +5848,7 @@ PALIMPORT char * __cdecl strstr(const char *, const char *); PALIMPORT char * __cdecl strtok(char *, const char *); PALIMPORT size_t __cdecl strspn(const char *, const char *); PALIMPORT size_t __cdecl strcspn(const char *, const char *); -PALIMPORT int __cdecl sprintf(char *, const char *, ...); PALIMPORT int __cdecl vsprintf(char *, const char *, va_list); -PALIMPORT int __cdecl sscanf(const char *, const char *, ...); PALIMPORT int __cdecl atoi(const char *); PALIMPORT LONG __cdecl atol(const char *); PALIMPORT ULONG __cdecl strtoul(const char *, char **, int); @@ -5898,6 +5894,7 @@ PALIMPORT int __cdecl sprintf_s(char *, size_t, const char *, ... ); PALIMPORT int __cdecl swprintf_s(WCHAR *, size_t, const WCHAR *, ... ); PALIMPORT int __cdecl _snwprintf_s(WCHAR *, size_t, size_t, const WCHAR *, ...); PALIMPORT int __cdecl vswprintf_s( WCHAR *, size_t, const WCHAR *, va_list); +PALIMPORT int __cdecl sscanf_s(const char *, const char *, ...); PALIMPORT errno_t __cdecl _itow_s(int, WCHAR *, size_t, int); PALIMPORT size_t __cdecl PAL_wcslen(const WCHAR *); diff --git a/src/pal/inc/rt/palrt.h b/src/pal/inc/rt/palrt.h index ab46f21efc..c181f38c2b 100644 --- a/src/pal/inc/rt/palrt.h +++ b/src/pal/inc/rt/palrt.h @@ -895,7 +895,6 @@ Remember to fix the errcode defintion in safecrt.h. #define _wcslwr_s _wcslwr_unsafe #define _snprintf_s _snprintf_unsafe #define swscanf_s swscanf -#define sscanf_s sscanf #define _wfopen_s _wfopen_unsafe #define fopen_s _fopen_unsafe diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 0f91edb150..28ee83a77c 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -186,8 +186,8 @@ set(SOURCES safecrt/safecrt_winput_s.cpp safecrt/safecrt_woutput_s.cpp safecrt/splitpath_s.cpp - safecrt/sprintf.cpp - safecrt/sscanf.cpp + safecrt/sprintf_s.cpp + safecrt/sscanf_s.cpp safecrt/strcat_s.cpp safecrt/strcpy_s.cpp safecrt/strlen_s.cpp diff --git a/src/pal/src/cruntime/printf.cpp b/src/pal/src/cruntime/printf.cpp index 83964183b2..c437b8e39f 100644 --- a/src/pal/src/cruntime/printf.cpp +++ b/src/pal/src/cruntime/printf.cpp @@ -1363,63 +1363,6 @@ int PAL_wvsscanf(LPCWSTR Buffer, LPCWSTR Format, va_list ap) return Length; } -/*++ -Function: - PAL_sscanf - -See MSDN doc. ---*/ -int -__cdecl -PAL_sscanf( - const char *buffer, - const char *format, - ...) -{ - int Length; - va_list ap; - - PERF_ENTRY(sscanf); - ENTRY("PAL_sscanf (buffer=%p (%s), format=%p (%s))\n", buffer, buffer, format, format); - - va_start(ap, format); - Length = PAL_vsscanf(buffer, format, ap); - va_end(ap); - - LOGEXIT("PAL_sscanf returns int %d\n", Length); - PERF_EXIT(sscanf); - return Length; -} - -/*++ -Function: - PAL_sprintf - -See MSDN doc. ---*/ -int -__cdecl -PAL_sprintf( - char *buffer, - const char *format, - ...) -{ - LONG Length; - va_list ap; - - PERF_ENTRY(sprintf); - ENTRY("PAL_sprintf (buffer=%p, format=%p (%s))\n", buffer, format, format); - - va_start(ap, format); - Length = InternalVsnprintf(CorUnix::InternalGetCurrentThread(), buffer, 0x7fffffff, format, ap); - va_end(ap); - - LOGEXIT("PAL_sprintf returns int %d\n", Length); - PERF_EXIT(sprintf); - return Length; -} - - /*++ Function: PAL_swprintf diff --git a/src/pal/src/debug/debug.cpp b/src/pal/src/debug/debug.cpp index 5461ac6265..756e615d66 100644 --- a/src/pal/src/debug/debug.cpp +++ b/src/pal/src/debug/debug.cpp @@ -857,7 +857,7 @@ DBGDetachProcess( if (nbAttachLeft == 0) { #if HAVE_PROCFS_CTL - sprintf(ctlPath, sizeof(ctlPath), "/proc/%d/ctl", processId); + snprintf(ctlPath, sizeof(ctlPath), "/proc/%d/ctl", processId); fd = InternalOpen(pThread, ctlPath, O_WRONLY); if (fd == -1) { diff --git a/src/pal/src/exception/machmessage.h b/src/pal/src/exception/machmessage.h index 46c09b8f37..abc583f6c4 100644 --- a/src/pal/src/exception/machmessage.h +++ b/src/pal/src/exception/machmessage.h @@ -36,7 +36,7 @@ using namespace CorUnix; if (machret != KERN_SUCCESS) \ { \ char _szError[1024]; \ - sprintf(_szError, "%s: %u: %s", __FUNCTION__, __LINE__, _msg); \ + snprintf(_szError, _countof(_szError), "%s: %u: %s", __FUNCTION__, __LINE__, _msg); \ mach_error(_szError, machret); \ abort(); \ } \ diff --git a/src/pal/src/include/pal/palinternal.h b/src/pal/src/include/pal/palinternal.h index 44f2528991..f7856be902 100644 --- a/src/pal/src/include/pal/palinternal.h +++ b/src/pal/src/include/pal/palinternal.h @@ -502,9 +502,7 @@ function_name() to call the system's implementation #undef vfwprintf #undef vprintf #undef wprintf -#undef sprintf #undef swprintf -#undef sscanf #undef wcstod #undef wcstol #undef wcstoul diff --git a/src/pal/src/safecrt/input.inl b/src/pal/src/safecrt/input.inl index eaad174ff5..25c4541029 100644 --- a/src/pal/src/safecrt/input.inl +++ b/src/pal/src/safecrt/input.inl @@ -671,7 +671,7 @@ scanit: #endif /* _SECURE_SCANF */ #ifndef _UNICODE if (fl_wchar_arg) { - wctemp = L'?'; + wctemp = W('?'); char temp[2]; temp[0] = (char) ch; #if 0 // we are not supporting multibyte input strings @@ -682,7 +682,7 @@ scanit: #endif /* 0 */ _MBTOWC(&wctemp, temp, MB_CUR_MAX); *(wchar_t UNALIGNED *)pointer = wctemp; - /* just copy L'?' if mbtowc fails, errno is set by mbtowc */ + /* just copy W('?') if mbtowc fails, errno is set by mbtowc */ pointer = (wchar_t *)pointer + 1; #ifdef _SECURE_SCANF --array_width; diff --git a/src/pal/src/safecrt/mbusafecrt.cpp b/src/pal/src/safecrt/mbusafecrt.cpp index 9b3ffd599c..4446f77fd1 100644 --- a/src/pal/src/safecrt/mbusafecrt.cpp +++ b/src/pal/src/safecrt/mbusafecrt.cpp @@ -147,7 +147,6 @@ int _ungetwc_nolock( wchar_t inChar, miniFILE* inStream ) /*** * _safecrt_cfltcvt - convert a float to an ascii string. -* Uses sprintf - this usage is OK. ****/ /* routine used for floating-point output */ @@ -197,14 +196,12 @@ void _safecrt_fassign(int flag, void* argument, char* number ) { if ( flag != 0 ) // double { - double dblValue = 0.0; - (void)sscanf( number, "%lf", &dblValue ); + double dblValue = strtod(number, NULL); *( ( double* )argument ) = dblValue; } else // float { - float fltValue = 0.0; - (void)sscanf( number, "%f", &fltValue ); + float fltValue = strtof(number, NULL); *( ( float* )argument ) = fltValue; } } diff --git a/src/pal/src/safecrt/sprintf.cpp b/src/pal/src/safecrt/sprintf_s.cpp similarity index 98% rename from src/pal/src/safecrt/sprintf.cpp rename to src/pal/src/safecrt/sprintf_s.cpp index 8a51d2644e..edfb768670 100644 --- a/src/pal/src/safecrt/sprintf.cpp +++ b/src/pal/src/safecrt/sprintf_s.cpp @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. /*** -*sprintf.c - print formatted to string +*sprintf_s.c - print formatted to string * * diff --git a/src/pal/src/safecrt/sscanf.cpp b/src/pal/src/safecrt/sscanf_s.cpp similarity index 99% rename from src/pal/src/safecrt/sscanf.cpp rename to src/pal/src/safecrt/sscanf_s.cpp index d6c21e8eca..4f548bccc6 100644 --- a/src/pal/src/safecrt/sscanf.cpp +++ b/src/pal/src/safecrt/sscanf_s.cpp @@ -3,7 +3,7 @@ // See the LICENSE file in the project root for more information. /*** -*sscanf.c - read formatted data from string +*sscanf_s.c - read formatted data from string * * diff --git a/src/pal/src/thread/process.cpp b/src/pal/src/thread/process.cpp index c57d604e9c..a64bfb8ab1 100644 --- a/src/pal/src/thread/process.cpp +++ b/src/pal/src/thread/process.cpp @@ -2049,18 +2049,18 @@ GetProcessIdDisambiguationKey(DWORD processId, UINT64 *disambiguationKey) // According to `man proc`, the second field in the stat file is the filename of the executable, // in parentheses. Tokenizing the stat file using spaces as separators breaks when that name - // has spaces in it, so we start using sscanf after skipping everything up to and including the + // has spaces in it, so we start using sscanf_s after skipping everything up to and including the // last closing paren and the space after it. char *scanStartPosition = strrchr(line, ')') + 2; // All the format specifiers for the fields in the stat file are provided by 'man proc'. - int sscanfRet = sscanf(scanStartPosition, + int sscanfRet = sscanf_s(scanStartPosition, "%*c %*d %*d %*d %*d %*d %*u %*lu %*lu %*lu %*lu %*lu %*lu %*ld %*ld %*ld %*ld %*ld %*ld %llu \n", &starttime); if (sscanfRet != 1) { - _ASSERTE(!"Failed to parse stat file contents with sscanf."); + _ASSERTE(!"Failed to parse stat file contents with sscanf_s."); return FALSE; } @@ -2690,7 +2690,7 @@ CreateProcessModules( char moduleName[PATH_MAX]; int size; - if (sscanf(line, "__TEXT %p-%p [ %dK] %*[-/rwxsp] SM=%*[A-Z] %s\n", &startAddress, &endAddress, &size, moduleName) == 4) + if (sscanf_s(line, "__TEXT %p-%p [ %dK] %*[-/rwxsp] SM=%*[A-Z] %s\n", &startAddress, &endAddress, &size, moduleName, _countof(moduleName)) == 4) { bool dup = false; for (ProcessModules *entry = listHead; entry != NULL; entry = entry->Next) @@ -2768,7 +2768,7 @@ exit: int devHi, devLo, inode; char moduleName[PATH_MAX]; - if (sscanf(line, "%p-%p %*[-rwxsp] %p %x:%x %d %s\n", &startAddress, &endAddress, &offset, &devHi, &devLo, &inode, moduleName) == 7) + if (sscanf_s(line, "%p-%p %*[-rwxsp] %p %x:%x %d %s\n", &startAddress, &endAddress, &offset, &devHi, &devLo, &inode, moduleName, _countof(moduleName)) == 7) { if (inode != 0) { diff --git a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt index d2da52785e..cf062530eb 100644 --- a/src/pal/tests/palsuite/c_runtime/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/CMakeLists.txt @@ -86,10 +86,10 @@ add_subdirectory(sin) add_subdirectory(sinf) add_subdirectory(sinh) add_subdirectory(sinhf) -add_subdirectory(sprintf) +add_subdirectory(sprintf_s) add_subdirectory(sqrt) add_subdirectory(sqrtf) -add_subdirectory(sscanf) +add_subdirectory(sscanf_s) add_subdirectory(strcat) add_subdirectory(strchr) add_subdirectory(strcmp) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt deleted file mode 100644 index 5d7ce6cb6d..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test5/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test5.cpp -) - -add_executable(paltest_sprintf_test5 - ${SOURCES} -) - -add_dependencies(paltest_sprintf_test5 coreclrpal) - -target_link_libraries(paltest_sprintf_test5 - pthread - m - coreclrpal -) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.cpp b/src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.cpp deleted file mode 100644 index 1b52da77b6..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test5/test5.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================================ -** -** Source: test5.c -** -** Purpose: Test #5 for the sprintf function. Tests the count specifier (%n). -** -** -**==========================================================================*/ - - - -#include -#include "../sprintf.h" - -/* - * Depends on memcmp and strlen - */ - - -int __cdecl main(int argc, char *argv[]) -{ - char *longStr = - "really-long-string-that-just-keeps-going-on-and-on-and-on.." - "..................useless-filler.................................." - "..................useless-filler.................................." - "..................useless-filler.................................." - "%n bar"; - char *longResult = - "really-long-string-that-just-keeps-going-on-and-on-and-on.." - "..................useless-filler.................................." - "..................useless-filler.................................." - "..................useless-filler.................................." - " bar"; - - if (PAL_Initialize(argc, argv)!= 0) - { - return FAIL; - } - - DoCountTest("foo %n bar", 4, "foo bar"); - DoCountTest(longStr, 257, longResult); - DoCountTest("fo%n bar", 2, "fo bar"); - DoCountTest("%n", 0, ""); - DoCountTest("foo %#n bar", 4, "foo bar"); - DoCountTest("foo % n bar", 4, "foo bar"); - DoCountTest("foo %+n bar", 4, "foo bar"); - DoCountTest("foo %-n bar", 4, "foo bar"); - DoCountTest("foo %0n bar", 4, "foo bar"); - DoShortCountTest("foo %hn bar", 4, "foo bar"); - DoCountTest("foo %ln bar", 4, "foo bar"); - DoCountTest("foo %Ln bar", 4, "foo bar"); - DoCountTest("foo %I64n bar", 4, "foo bar"); - DoCountTest("foo %20.3n bar", 4, "foo bar"); - - PAL_Terminate(); - - return PASS; -} diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf/test5/testinfo.dat deleted file mode 100644 index 31e0537bd0..0000000000 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test5/testinfo.dat +++ /dev/null @@ -1,12 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf -TYPE = DEFAULT -EXE1 = test5 -Description -= Tests sprintf with the count specifier diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/CMakeLists.txt similarity index 95% rename from src/pal/tests/palsuite/c_runtime/sprintf/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/CMakeLists.txt index cafb9536b0..8fe1cb60ac 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/CMakeLists.txt +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/CMakeLists.txt @@ -14,7 +14,6 @@ add_subdirectory(test19) add_subdirectory(test2) add_subdirectory(test3) add_subdirectory(test4) -add_subdirectory(test5) add_subdirectory(test6) add_subdirectory(test7) add_subdirectory(test8) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/sprintf.h b/src/pal/tests/palsuite/c_runtime/sprintf_s/sprintf_s.h similarity index 86% rename from src/pal/tests/palsuite/c_runtime/sprintf/sprintf.h rename to src/pal/tests/palsuite/c_runtime/sprintf_s/sprintf_s.h index 6ec4a4d591..129b9db727 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/sprintf.h +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/sprintf_s.h @@ -4,21 +4,21 @@ /*============================================================================ ** -** Source: sprintf.h +** Source: sprintf_s.h ** -** Purpose: Containts common testing functions for sprintf +** Purpose: Containts common testing functions for sprintf_s ** ** **==========================================================================*/ -#ifndef __SPRINTF_H__ -#define __SPRINTF_H__ +#ifndef __SPRINTF_S_H__ +#define __SPRINTF_S_H__ void DoStrTest(const char *formatstr, char* param, const char *checkstr) { char buf[256] = { 0 }; - sprintf(buf, formatstr, param); + sprintf_s(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) { Fail("ERROR: failed to insert string \"%s\" into \"%s\"\n" @@ -31,7 +31,7 @@ void DoWStrTest(const char *formatstr, WCHAR* param, const char *checkstr) { char buf[256] = { 0 }; - sprintf(buf, formatstr, param); + sprintf_s(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) { Fail("ERROR: failed to insert wide string \"%s\" into \"%s\"\n" @@ -45,7 +45,7 @@ void DoPointerTest(const char *formatstr, void* param, char* paramstr, { char buf[256] = { 0 }; - sprintf(buf, formatstr, param); + sprintf_s(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) { Fail("ERROR: failed to insert %s into \"%s\"\n" @@ -59,7 +59,7 @@ void DoCountTest(const char *formatstr, int param, const char *checkstr) char buf[512] = { 0 }; int n = -1; - sprintf(buf, formatstr, &n); + sprintf_s(buf, _countof(buf), formatstr, &n); if (n != param) { @@ -77,7 +77,7 @@ void DoShortCountTest(const char *formatstr, int param, const char *checkstr) char buf[256] = { 0 }; short int n = -1; - sprintf(buf, formatstr, &n); + sprintf_s(buf, _countof(buf), formatstr, &n); if (n != param) { @@ -95,7 +95,7 @@ void DoCharTest(const char *formatstr, char param, const char *checkstr) { char buf[256] = { 0 }; - sprintf(buf, formatstr, param); + sprintf_s(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) { Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n" @@ -108,7 +108,7 @@ void DoWCharTest(const char *formatstr, WCHAR param, const char *checkstr) { char buf[256] = { 0 }; - sprintf(buf, formatstr, param); + sprintf_s(buf, _countof(buf), formatstr, param); if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) { Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n" @@ -121,7 +121,7 @@ void DoNumTest(const char *formatstr, int value, const char *checkstr) { char buf[256] = { 0 }; - sprintf(buf, formatstr, value); + sprintf_s(buf, _countof(buf), formatstr, value); if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0) { Fail("ERROR: failed to insert %#x into \"%s\"\n" @@ -134,7 +134,7 @@ void DoI64Test(const char *formatstr, INT64 value, char *valuestr, const char *c { char buf[256] = { 0 }; - sprintf(buf, formatstr, value); + sprintf_s(buf, _countof(buf), formatstr, value); if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0) { Fail("ERROR: failed to insert %s into \"%s\"\n" @@ -148,7 +148,7 @@ void DoDoubleTest(const char *formatstr, double value, const char *checkstr1, { char buf[256] = { 0 }; - sprintf(buf, formatstr, value); + sprintf_s(buf, _countof(buf), formatstr, value); if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) { @@ -163,7 +163,7 @@ void DoArgumentPrecTest(const char *formatstr, int precision, void *param, { char buf[256]; - sprintf(buf, formatstr, precision, param); + sprintf_s(buf, _countof(buf), formatstr, precision, param); if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) { @@ -179,7 +179,7 @@ void DoArgumentPrecDoubleTest(const char *formatstr, int precision, double param { char buf[256]; - sprintf(buf, formatstr, precision, param); + sprintf_s(buf, _countof(buf), formatstr, precision, param); if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 && memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0) { diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test1/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test1/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/test1.cpp similarity index 85% rename from src/pal/tests/palsuite/c_runtime/sprintf/test1/test1.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test1/test1.cpp index 42e27f263b..a289c07716 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test1/test1.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/test1.cpp @@ -6,7 +6,7 @@ ** ** Source: test1.c ** -** Purpose: Test #1 for the sprintf function. A single, basic, test +** Purpose: Test #1 for the sprintf_s function. A single, basic, test ** case with no formatting. ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen @@ -32,7 +32,7 @@ int __cdecl main(int argc, char *argv[]) } - sprintf(buf, "hello world"); + sprintf_s(buf, _countof(buf), "hello world"); if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0) { diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/testinfo.dat similarity index 71% rename from src/pal/tests/palsuite/c_runtime/sprintf/test1/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test1/testinfo.dat index abe07445cc..255c534cdf 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test1/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test1/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test1 Description -= General test to see if sprintf works correctly += General test to see if sprintf_s works correctly diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test10/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test10/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/test10.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sprintf/test10/test10.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test10/test10.cpp index ae7dbfb177..bbda15a331 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test10/test10.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/test10.cpp @@ -6,7 +6,7 @@ ** ** Source: test10.c ** -** Purpose: Test #10 for the sprintf function. Tests the octal specifier +** Purpose: Test #10 for the sprintf_s function. Tests the octal specifier ** (%o). ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sprintf/test10/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test10/testinfo.dat index 70b7f3ab75..25ed554ea3 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test10/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test10/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test10 Description -= Tests sprintf with octal numbers += Tests sprintf_s with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test11/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test11/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/test11.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sprintf/test11/test11.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test11/test11.cpp index 0b5b5ab93d..7f4fca9f32 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test11/test11.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/test11.cpp @@ -6,7 +6,7 @@ ** ** Source: test11.c ** -** Purpose: Test #11 for the sprintf function. Test the unsigned int +** Purpose: Test #11 for the sprintf_s function. Test the unsigned int ** specifier (%u). ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sprintf/test11/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test11/testinfo.dat index 852bd3e7b6..3144f1290e 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test11/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test11/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test11 Description -= Tests sprintf with unsigned numbers += Tests sprintf_s with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test12/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test12/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/test12.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sprintf/test12/test12.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test12/test12.cpp index c2e778e494..759a41105b 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test12/test12.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/test12.cpp @@ -6,7 +6,7 @@ ** ** Source: test12.c ** -** Purpose: Test #12 for the sprintf function. Tests the (lowercase) +** Purpose: Test #12 for the sprintf_s function. Tests the (lowercase) ** hexadecimal specifier (%x) ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/testinfo.dat similarity index 72% rename from src/pal/tests/palsuite/c_runtime/sprintf/test12/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test12/testinfo.dat index 5df91d0e6a..ed91cecc46 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test12/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test12/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test12 Description -= Tests sprintf with hex numbers (lowercase) += Tests sprintf_s with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test13/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test13/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/test13.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sprintf/test13/test13.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test13/test13.cpp index 0b4b7ed9ae..76250d058c 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test13/test13.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/test13.cpp @@ -6,7 +6,7 @@ ** ** Source: test13.c ** -** Purpose: Test #13 for the sprintf function. Tests the (uppercase) +** Purpose: Test #13 for the sprintf_s function. Tests the (uppercase) ** hexadecimal specifier (%X) ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/testinfo.dat similarity index 72% rename from src/pal/tests/palsuite/c_runtime/sscanf/test13/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test13/testinfo.dat index 1c4c2fc26e..fd5f53017c 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test13/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test13/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test13 Description -= Tests sscanf with floats (decimal notation) += Tests sprintf_s with hex numbers (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test14/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test14/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/test14.cpp similarity index 95% rename from src/pal/tests/palsuite/c_runtime/sprintf/test14/test14.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test14/test14.cpp index 20e986a9c3..668edda433 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test14/test14.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/test14.cpp @@ -6,7 +6,7 @@ ** ** Source: test14.c ** -** Purpose: Test #14 for the sprintf function. Tests the lowercase +** Purpose: Test #14 for the sprintf_s function. Tests the lowercase ** exponential notation double specifier (%e) ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/testinfo.dat similarity index 70% rename from src/pal/tests/palsuite/c_runtime/sscanf/test14/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test14/testinfo.dat index 97db6e4ffd..23cf423354 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test14/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test14/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test14 Description -= Tests sscanf with floats (exponential notation, lowercase) += Tests sprintf_s with exponential format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test15/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test15/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/test15.cpp similarity index 95% rename from src/pal/tests/palsuite/c_runtime/sprintf/test15/test15.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test15/test15.cpp index 34199b2eb3..61e0e362a1 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test15/test15.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/test15.cpp @@ -6,7 +6,7 @@ ** ** Source: test15.c ** -** Purpose: Test #15 for the sprintf function. Tests the uppercase +** Purpose: Test #15 for the sprintf_s function. Tests the uppercase ** exponential notation double specifier (%E) ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/testinfo.dat similarity index 70% rename from src/pal/tests/palsuite/c_runtime/sscanf/test15/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test15/testinfo.dat index 30c2cf4b30..537e6d1db2 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test15/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test15/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test15 Description -= Tests sscanf with floats (exponential notation, uppercase) += Tests sprintf_s with exponential format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test16/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test16/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/test16.cpp similarity index 94% rename from src/pal/tests/palsuite/c_runtime/sprintf/test16/test16.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test16/test16.cpp index c93b68bc2d..b237c98d5c 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test16/test16.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/test16.cpp @@ -6,7 +6,7 @@ ** ** Source: test16.c ** -** Purpose: Test #16 for the sprintf function. Tests the decimal notation +** Purpose: Test #16 for the sprintf_s function. Tests the decimal notation ** double specifier (%f) ** ** @@ -14,7 +14,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/testinfo.dat similarity index 71% rename from src/pal/tests/palsuite/c_runtime/sprintf/test16/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test16/testinfo.dat index e18fab1ad8..4e98eccac2 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test16/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test16/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test16 Description -= Tests sprintf with decimal point format doubles += Tests sprintf_s with decimal point format doubles diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test17/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test17/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/test17.cpp similarity index 94% rename from src/pal/tests/palsuite/c_runtime/sprintf/test17/test17.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test17/test17.cpp index 643215b8f5..220555e5d4 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test17/test17.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/test17.cpp @@ -6,7 +6,7 @@ ** ** Source: test17.c ** -** Purpose: Test #17 for the sprintf function. Tests the lowercase +** Purpose: Test #17 for the sprintf_s function. Tests the lowercase ** shorthand notation double specifier (%g) ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/testinfo.dat similarity index 70% rename from src/pal/tests/palsuite/c_runtime/sscanf/test17/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test17/testinfo.dat index e23be8541e..5e41e20d44 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test17/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test17/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test17 Description -= Tests sscanf with floats (compact notation, uppercase) += Tests sprintf_s with compact format doubles (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test18/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test18/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test18/test18.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/test18.cpp similarity index 94% rename from src/pal/tests/palsuite/c_runtime/sprintf/test18/test18.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test18/test18.cpp index fa88152479..2135a6f1e7 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test18/test18.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/test18.cpp @@ -6,7 +6,7 @@ ** ** Source: test18.c ** -** Purpose: Test #18 for the sprintf function. Tests the uppercase +** Purpose: Test #18 for the sprintf_s function. Tests the uppercase ** shorthand notation double specifier (%G) ** ** @@ -14,7 +14,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/testinfo.dat similarity index 70% rename from src/pal/tests/palsuite/c_runtime/sprintf/test18/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test18/testinfo.dat index dfafa4bcf4..06ae3a632e 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test18/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test18/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test18 Description -= Tests sprintf with compact format doubles (uppercase) += Tests sprintf_s with compact format doubles (uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test19/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test19/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test19/test19.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/test19.cpp similarity index 90% rename from src/pal/tests/palsuite/c_runtime/sprintf/test19/test19.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test19/test19.cpp index bf3360c567..483c7167b1 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test19/test19.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/test19.cpp @@ -6,7 +6,7 @@ ** ** Source: test19.c ** -** Purpose: Test #19 for the sprintf function. Tests the variable length +** Purpose: Test #19 for the sprintf_s function. Tests the variable length ** precision argument. ** ** @@ -14,7 +14,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen @@ -33,13 +33,6 @@ int __cdecl main(int argc, char *argv[]) DoArgumentPrecTest("%.*s", 2, (void*)"bar", "bar", "ba", "ba"); DoArgumentPrecTest("%.*S", 2, (void*)convert("bar"), "bar", "ba", "ba"); - DoArgumentPrecTest("%.*n", 3, (void*)&n, "pointer to int", "", ""); - if (n != 0) - { - Fail("ERROR: Expected count parameter to resolve to %d, got %X\n", - 0, n); - } - DoArgumentPrecTest("%.*c", 0, (void*)'a', "a", "a", "a"); DoArgumentPrecTest("%.*c", 4, (void*)'a', "a", "a", "a"); DoArgumentPrecTest("%.*C", 0, (void*)'a', "a", "a", "a"); diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/testinfo.dat similarity index 71% rename from src/pal/tests/palsuite/c_runtime/sprintf/test19/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test19/testinfo.dat index ebd13025f6..7064c01771 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test19/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test19/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test19 Description -= Tests sprintf with argument specified precision += Tests sprintf_s with argument specified precision diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test2/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test2/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/test2.cpp similarity index 91% rename from src/pal/tests/palsuite/c_runtime/sprintf/test2/test2.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test2/test2.cpp index d50679a5a3..990f4f04a8 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test2/test2.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/test2.cpp @@ -6,7 +6,7 @@ ** ** Source: test2.c ** -** Purpose: Test #2 for the sprintf function. Tests the string specifier +** Purpose: Test #2 for the sprintf_s function. Tests the string specifier ** (%s). ** ** @@ -14,7 +14,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/testinfo.dat similarity index 75% rename from src/pal/tests/palsuite/c_runtime/sprintf/test2/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test2/testinfo.dat index e8d0f53ff3..cce2dc67e7 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test2/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test2/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test2 Description -= Tests sprintf with strings += Tests sprintf_s with strings diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test3/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test3/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/test3.cpp similarity index 92% rename from src/pal/tests/palsuite/c_runtime/sprintf/test3/test3.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test3/test3.cpp index ae52dbed08..c0dc8e1716 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test3/test3.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/test3.cpp @@ -6,7 +6,7 @@ ** ** Source: test3.c ** -** Purpose: Test #3 for the sprintf function. Tests the wide string +** Purpose: Test #3 for the sprintf_s function. Tests the wide string ** specifier (%S). ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sscanf/test3/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test3/testinfo.dat index c38a498225..cc8de0eae5 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test3/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test3/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test3 Description -= Tests sscanf with bracketed set strings += Tests sprintf_s with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test4/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test4/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp similarity index 96% rename from src/pal/tests/palsuite/c_runtime/sprintf/test4/test4.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp index 9660ffaa3a..46115ad5ae 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/test4.cpp @@ -6,7 +6,7 @@ ** ** Source: test4.c ** -** Purpose: Test #4 for the sprintf function. Tests the pointer +** Purpose: Test #4 for the sprintf_s function. Tests the pointer ** specifier (%p). ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen */ diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/testinfo.dat similarity index 75% rename from src/pal/tests/palsuite/c_runtime/sscanf/test4/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test4/testinfo.dat index 868056a6a5..f53f784991 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test4/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test4/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test4 Description -= Tests sscanf with decimal numbers += Tests sprintf_s with pointers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test6/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test6/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/test6.cpp similarity index 91% rename from src/pal/tests/palsuite/c_runtime/sprintf/test6/test6.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test6/test6.cpp index c14e075475..c5fc804071 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test6/test6.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/test6.cpp @@ -6,7 +6,7 @@ ** ** Source: test6.c ** -** Purpose: Test #6 for the sprintf function. Tests the char specifier (%c). +** Purpose: Test #6 for the sprintf_s function. Tests the char specifier (%c). ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/testinfo.dat similarity index 75% rename from src/pal/tests/palsuite/c_runtime/sprintf/test6/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test6/testinfo.dat index 037e4106ff..c5b93fc78c 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test6/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test6/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test6 Description -= Tests sprintf with characters += Tests sprintf_s with characters diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test7/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test7/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/test7.cpp similarity index 92% rename from src/pal/tests/palsuite/c_runtime/sprintf/test7/test7.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test7/test7.cpp index 082bd20e6d..fd46ae9674 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test7/test7.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/test7.cpp @@ -6,7 +6,7 @@ ** ** Source: test7.c ** -** Purpose: Test #7 for the sprintf function. Tests the wide char +** Purpose: Test #7 for the sprintf_s function. Tests the wide char ** specifier (%C). ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sprintf/test7/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test7/testinfo.dat index a2730bc97c..647c9d80fd 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test7/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test7/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test7 Description -= Tests sprintf with wide characters += Tests sprintf_s with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test8/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test8/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/test8.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sprintf/test8/test8.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test8/test8.cpp index 9587c82c94..db02627bb0 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test8/test8.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/test8.cpp @@ -6,7 +6,7 @@ ** ** Source: test8.c ** -** Purpose: Test #8 for the sprintf function. Tests the decimal +** Purpose: Test #8 for the sprintf_s function. Tests the decimal ** specifier (%d). ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sscanf/test8/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test8/testinfo.dat index 2cbc31ad2a..524834e53e 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test8/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test8/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test8 Description -= Tests sscanf with unsigned numbers += Tests sprintf_s with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sprintf/test9/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test9/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/test9.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sprintf/test9/test9.cpp rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test9/test9.cpp index 98f5db6ec1..2e1c78ce68 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test9/test9.cpp +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/test9.cpp @@ -6,7 +6,7 @@ ** ** Source: test9.c ** -** Purpose: Test #9 for the sprintf function. Tests the integer +** Purpose: Test #9 for the sprintf_s function. Tests the integer ** specifier (%i). ** ** @@ -15,7 +15,7 @@ #include -#include "../sprintf.h" +#include "../sprintf_s.h" /* * Depends on memcmp and strlen diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sprintf/test9/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sprintf_s/test9/testinfo.dat index e569e789cd..7c51443a3d 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test9/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sprintf_s/test9/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sprintf_s +Name = Positive Test for sprintf_s TYPE = DEFAULT EXE1 = test9 Description -= Tests sprintf with integer numbers += Tests sprintf_s with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/sscanf.h b/src/pal/tests/palsuite/c_runtime/sscanf_s/sscanf_s.h similarity index 80% rename from src/pal/tests/palsuite/c_runtime/sscanf/sscanf.h rename to src/pal/tests/palsuite/c_runtime/sscanf_s/sscanf_s.h index 397f05cead..8a99d87cb4 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/sscanf.h +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/sscanf_s.h @@ -4,15 +4,15 @@ /*============================================================================ ** -** Source: sscanf.h +** Source: sscanf_s.h ** -** Purpose: Contains common testing functions for sscanf.h +** Purpose: Contains common testing functions for sscanf_s ** ** **==========================================================================*/ -#ifndef __SSCANF_H__ -#define __SSCANF_H__ +#ifndef __SSCANF_S_H__ +#define __SSCANF_S_H__ void DoVoidTest(char *inputstr, const char *formatstr) { @@ -20,10 +20,10 @@ void DoVoidTest(char *inputstr, const char *formatstr) int i; int ret; - ret = sscanf(inputstr, formatstr, buf); + ret = sscanf_s(inputstr, formatstr, buf); if (ret != 0) { - Fail("ERROR: Expected sscanf to return 0, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 0, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } @@ -43,10 +43,10 @@ void DoStrTest(char *inputstr, const char *formatstr, const char *checkstr) char buf[256] = { 0 }; int ret; - ret = sscanf(inputstr, formatstr, buf); + ret = sscanf_s(inputstr, formatstr, buf, _countof(buf)); if (ret != 1) { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } @@ -64,10 +64,10 @@ void DoWStrTest(char *inputstr, const char *formatstr, const WCHAR *checkstr) WCHAR buf[256] = { 0 }; int ret; - ret = sscanf(inputstr, formatstr, buf); + ret = sscanf_s(inputstr, formatstr, buf, _countof(buf)); if (ret != 1) { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } @@ -85,10 +85,10 @@ void DoNumTest(char *inputstr, const char *formatstr, int checknum) int num; int ret; - ret = sscanf(inputstr, formatstr, &num); + ret = sscanf_s(inputstr, formatstr, &num); if (ret != 1) { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } @@ -104,10 +104,10 @@ void DoShortNumTest(char *inputstr, const char *formatstr, short checknum) short num; int ret; - ret = sscanf(inputstr, formatstr, &num); + ret = sscanf_s(inputstr, formatstr, &num); if (ret != 1) { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } @@ -125,17 +125,17 @@ void DoI64NumTest(char *inputstr, const char *formatstr, INT64 checknum) INT64 num; int ret; - ret = sscanf(inputstr, formatstr, &num); + ret = sscanf_s(inputstr, formatstr, &num); if (ret != 1) { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } if (checknum != num) { - sprintf(buf, "%I64d", num); - sprintf(check, "%I64d", checknum); + sprintf_s(buf, _countof(buf), "%I64d", num); + sprintf_s(check, _countof(check), "%I64d", checknum); Fail("ERROR: scanned I64 number incorrectly from \"%s\" using \"%s\".\n" "Expected %s, got %s.\n", inputstr, formatstr, check, buf); } @@ -150,10 +150,10 @@ void DoCharTest(char *inputstr, const char *formatstr, char* checkchars, int num for (i=0; i<256; i++) buf[i] = (char)-1; - ret = sscanf(inputstr, formatstr, buf); + ret = sscanf_s(inputstr, formatstr, buf, _countof(buf)); if (ret != 1) { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } @@ -183,10 +183,10 @@ void DoWCharTest(char *inputstr, const char *formatstr, WCHAR* checkchars, int n for (i=0; i<256; i++) buf[i] = (WCHAR)-1; - ret = sscanf(inputstr, formatstr, buf); + ret = sscanf_s(inputstr, formatstr, buf, _countof(buf)); if (ret != 1) { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } @@ -218,12 +218,12 @@ void DoFloatTest(char *inputstr, const char *formatstr, float checkval) for (i=0; i<256; i++) buf[i] = (char)-1; - ret = sscanf(inputstr, formatstr, buf); + ret = sscanf_s(inputstr, formatstr, buf); val = *(float*)buf; if (ret != 1) { - Fail("ERROR: Expected sscanf to return 1, got %d.\n" + Fail("ERROR: Expected sscanf_s to return 1, got %d.\n" "Using \"%s\" in \"%s\".\n", ret, inputstr, formatstr); } diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test1/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test1/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/test1.cpp similarity index 91% rename from src/pal/tests/palsuite/c_runtime/sscanf/test1/test1.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test1/test1.cpp index c6f66a1d20..61313146e5 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test1/test1.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/test1.cpp @@ -6,7 +6,7 @@ ** ** Source: test1.c ** -** Purpose: General test of sscanf +** Purpose: General test of sscanf_s ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) @@ -38,7 +38,7 @@ int __cdecl main(int argc, char *argv[]) DoVoidTest("foo bar baz", "foo % bar %s"); DoVoidTest("foo baz bar", "foo% baz %s"); - ret = sscanf("foo bar baz", "foo bar %n", &num); + ret = sscanf_s("foo bar baz", "foo bar %n", &num); if (ret != 0 || num != 8) { Fail("ERROR: Got incorrect values in scanning \"%s\" using \"%s\".\n" diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/testinfo.dat similarity index 77% rename from src/pal/tests/palsuite/c_runtime/sscanf/test1/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test1/testinfo.dat index ef33ba9e13..76f592769f 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test1/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test1/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test1 Description -= General test of sscanf += General test of sscanf_s diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test10/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test10/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test10/test10.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/test10.cpp similarity index 92% rename from src/pal/tests/palsuite/c_runtime/sscanf/test10/test10.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test10/test10.cpp index aac5be43ae..0c63c864ed 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test10/test10.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/test10.cpp @@ -6,7 +6,7 @@ ** ** Source: test10.c ** -** Purpose: Tests sscanf with wide charactersn +** Purpose: Tests sscanf_s with wide characters ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/testinfo.dat similarity index 75% rename from src/pal/tests/palsuite/c_runtime/sscanf/test10/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test10/testinfo.dat index 7e854ed235..e048e700a0 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test10/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test10/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test10 Description -= Tests sscanf with wide characters += Tests sscanf_s with wide characters diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test11/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test11/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test11/test11.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/test11.cpp similarity index 92% rename from src/pal/tests/palsuite/c_runtime/sscanf/test11/test11.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test11/test11.cpp index 0e3db6cca0..8279f4b3f4 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test11/test11.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/test11.cpp @@ -6,7 +6,7 @@ ** ** Source: test11.c ** -** Purpose: Tests sscanf with strings +** Purpose: Tests sscanf_s with strings ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/testinfo.dat similarity index 76% rename from src/pal/tests/palsuite/c_runtime/sscanf/test11/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test11/testinfo.dat index 60f5cc46a4..5a906ddf51 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test11/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test11/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test11 Description -= Tests sscanf with strings += Tests sscanf_s with strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test12/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test12/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test12/test12.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/test12.cpp similarity index 92% rename from src/pal/tests/palsuite/c_runtime/sscanf/test12/test12.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test12/test12.cpp index f800e452c0..e599534270 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test12/test12.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/test12.cpp @@ -6,7 +6,7 @@ ** ** Source: test12.c ** -** Purpose: Tests sscanf with wide strings +** Purpose: Tests sscanf_s with wide strings ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/testinfo.dat similarity index 75% rename from src/pal/tests/palsuite/c_runtime/sscanf/test12/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test12/testinfo.dat index 3c453bf53a..569be983c0 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test12/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test12/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test12 Description -= Tests sscanf with wide strings += Tests sscanf_s with wide strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test13/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test13/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test13/test13.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/test13.cpp similarity index 91% rename from src/pal/tests/palsuite/c_runtime/sscanf/test13/test13.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test13/test13.cpp index 314604e3ac..4fc12bb751 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test13/test13.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/test13.cpp @@ -6,7 +6,7 @@ ** ** Source: test13.c ** -** Purpose: Tests sscanf with floats (decimal notation) +** Purpose: Tests sscanf_s with floats (decimal notation) ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/testinfo.dat similarity index 73% rename from src/pal/tests/palsuite/c_runtime/sprintf/test13/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test13/testinfo.dat index 634817a791..651577befd 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test13/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test13/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test13 Description -= Tests sprintf with hex numbers (uppercase) += Tests sscanf_s with floats (decimal notation) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test14/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test14/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test14/test14.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/test14.cpp similarity index 89% rename from src/pal/tests/palsuite/c_runtime/sscanf/test14/test14.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test14/test14.cpp index d1291a3b65..fc2fa2ee15 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test14/test14.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/test14.cpp @@ -6,7 +6,7 @@ ** ** Source: test14.c ** -** Purpose: Tests sscanf with floats (exponential notation, lowercase) +** Purpose: Tests sscanf_s with floats (exponential notation, lowercase) ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/testinfo.dat similarity index 70% rename from src/pal/tests/palsuite/c_runtime/sprintf/test14/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test14/testinfo.dat index c7086efdbc..8e7338fd46 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test14/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test14/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test14 Description -= Tests sprintf with exponential format doubles (lowercase) += Tests sscanf_s with floats (exponential notation, lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test15/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test15/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test15/test15.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/test15.cpp similarity index 90% rename from src/pal/tests/palsuite/c_runtime/sscanf/test15/test15.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test15/test15.cpp index fa51467d85..1eff995b86 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test15/test15.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/test15.cpp @@ -6,7 +6,7 @@ ** ** Source: test15.c ** -** Purpose: Tests sscanf with floats (exponential notation, uppercase +** Purpose: Tests sscanf_s with floats (exponential notation, uppercase ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/testinfo.dat similarity index 70% rename from src/pal/tests/palsuite/c_runtime/sprintf/test15/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test15/testinfo.dat index 0a47c5321a..d713a73d81 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test15/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test15/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test15 Description -= Tests sprintf with exponential format doubles (uppercase) += Tests sscanf_s with floats (exponential notation, uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test16/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test16/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test16/test16.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/test16.cpp similarity index 90% rename from src/pal/tests/palsuite/c_runtime/sscanf/test16/test16.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test16/test16.cpp index 787b72ed0a..f202767448 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test16/test16.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/test16.cpp @@ -6,7 +6,7 @@ ** ** Source: test16.c ** -** Purpose:Tests sscanf with floats (compact notation, lowercase) +** Purpose:Tests sscanf_s with floats (compact notation, lowercase) ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/testinfo.dat similarity index 70% rename from src/pal/tests/palsuite/c_runtime/sscanf/test16/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test16/testinfo.dat index 2c1dd42b70..669611945d 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test16/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test16/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test16 Description -= Tests sscanf with floats (compact notation, lowercase) += Tests sscanf_s with floats (compact notation, lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test17/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test17/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test17/test17.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/test17.cpp similarity index 90% rename from src/pal/tests/palsuite/c_runtime/sscanf/test17/test17.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test17/test17.cpp index c0dfd1699c..a18c3caff1 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test17/test17.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/test17.cpp @@ -6,7 +6,7 @@ ** ** Source: test17.c ** -** Purpose: Tests sscanf with floats (compact notation, uppercase) +** Purpose: Tests sscanf_s with floats (compact notation, uppercase) ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/testinfo.dat similarity index 70% rename from src/pal/tests/palsuite/c_runtime/sprintf/test17/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test17/testinfo.dat index a723103e02..8ce4e93e1a 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test17/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test17/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test17 Description -= Tests sprintf with compact format doubles (lowercase) += Tests sscanf_s with floats (compact notation, uppercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test2/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test2/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test2/test2.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/test2.cpp similarity index 92% rename from src/pal/tests/palsuite/c_runtime/sscanf/test2/test2.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test2/test2.cpp index 1221124e3a..c9c79f67ea 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test2/test2.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/test2.cpp @@ -6,7 +6,7 @@ ** ** Source: test2.c ** -** Purpose: Test to see if sscanf handles whitespace correctly +** Purpose: Test to see if sscanf_s handles whitespace correctly ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" /* diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/testinfo.dat similarity index 71% rename from src/pal/tests/palsuite/c_runtime/sscanf/test2/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test2/testinfo.dat index f5ee4b52d4..85fed244f9 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test2/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test2/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test2 Description -= Test to see if sscanf handles whitespace correctly += Test to see if sscanf_s handles whitespace correctly diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test3/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test3/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test3/test3.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/test3.cpp similarity index 91% rename from src/pal/tests/palsuite/c_runtime/sscanf/test3/test3.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test3/test3.cpp index 9d18991070..e1e45bdd70 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test3/test3.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/test3.cpp @@ -6,7 +6,7 @@ ** ** Source: test3.c ** -** Purpose: Tests sscanf with bracketed set strings +** Purpose: Tests sscanf_s with bracketed set strings ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/testinfo.dat similarity index 73% rename from src/pal/tests/palsuite/c_runtime/sprintf/test3/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test3/testinfo.dat index 12e0a9cfb0..523d31e82e 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test3/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test3/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test3 Description -= Tests sprintf with wide strings += Tests sscanf_s with bracketed set strings diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test4/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test4/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp index dd0538bcfe..f8413ea7fd 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test4/test4.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/test4.cpp @@ -6,7 +6,7 @@ ** ** Source: test4.c ** -** Purpose: Tests sscanf with decimal numbers +** Purpose: Tests sscanf_s with decimal numbers ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sprintf/test4/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test4/testinfo.dat index bf7236dc32..2065f2bea2 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test4/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test4/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test4 Description -= Tests sprintf with pointers += Tests sscanf_s with decimal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test5/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test5/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp index 0d45248af3..cdfefd860b 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test5/test5.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/test5.cpp @@ -6,7 +6,7 @@ ** ** Source: test5.c ** -** Purpose: Tests sscanf with integer numbers +** Purpose: Tests sscanf_s with integer numbers ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sscanf/test5/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test5/testinfo.dat index 8678dc8f5a..cb687c15cd 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test5/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test5/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test5 Description -= Tests sscanf with integer numbers += Tests sscanf_s with integer numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test6/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test6/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp index c45ea31b04..507b100e15 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test6/test6.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/test6.cpp @@ -6,7 +6,7 @@ ** ** Source: test6.c ** -** Purpose: Tests sscanf with octal numbers +** Purpose: Tests sscanf_s with octal numbers ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/testinfo.dat similarity index 75% rename from src/pal/tests/palsuite/c_runtime/sscanf/test6/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test6/testinfo.dat index b2547a776a..9e518dddf2 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test6/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test6/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test6 Description -= Tests sscanf with octal numbers += Tests sscanf_s with octal numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test7/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test7/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp index 0899671d64..4093e009e1 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test7/test7.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/test7.cpp @@ -6,7 +6,7 @@ ** ** Source: test7.c ** -** Purpose: Tests sscanf with hex numbers (lowercase) +** Purpose: Tests sscanf_s with hex numbers (lowercase) ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/testinfo.dat similarity index 73% rename from src/pal/tests/palsuite/c_runtime/sscanf/test7/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test7/testinfo.dat index 614333e650..8d6c182c90 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test7/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test7/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test7 Description -= Tests sscanf with hex numbers (lowercase) += Tests sscanf_s with hex numbers (lowercase) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test8/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test8/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp similarity index 93% rename from src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp index 53252f8929..23ef22a56a 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test8/test8.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/test8.cpp @@ -6,7 +6,7 @@ ** ** Source: test8.c ** -** Purpose:Tests sscanf with unsigned number +** Purpose:Tests sscanf_s with unsigned number ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) { diff --git a/src/pal/tests/palsuite/c_runtime/sprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/testinfo.dat similarity index 74% rename from src/pal/tests/palsuite/c_runtime/sprintf/test8/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test8/testinfo.dat index adc0b66f06..0287a495d2 100644 --- a/src/pal/tests/palsuite/c_runtime/sprintf/test8/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test8/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section = C Runtime -Function = sprintf -Name = Positive Test for sprintf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test8 Description -= Tests sprintf with decimal numbers += Tests sscanf_s with unsigned numbers diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/CMakeLists.txt similarity index 100% rename from src/pal/tests/palsuite/c_runtime/sscanf/test9/CMakeLists.txt rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test9/CMakeLists.txt diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test9/test9.cpp b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/test9.cpp similarity index 92% rename from src/pal/tests/palsuite/c_runtime/sscanf/test9/test9.cpp rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test9/test9.cpp index c5a2e0de5d..2c99c40e5d 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test9/test9.cpp +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/test9.cpp @@ -6,7 +6,7 @@ ** ** Source: test9.c ** -** Purpose: Tests sscanf with characters +** Purpose: Tests sscanf_s with characters ** ** **==========================================================================*/ @@ -14,7 +14,7 @@ #include -#include "../sscanf.h" +#include "../sscanf_s.h" int __cdecl main(int argc, char *argv[]) diff --git a/src/pal/tests/palsuite/c_runtime/sscanf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/testinfo.dat similarity index 75% rename from src/pal/tests/palsuite/c_runtime/sscanf/test9/testinfo.dat rename to src/pal/tests/palsuite/c_runtime/sscanf_s/test9/testinfo.dat index c0ccc8a4c9..95f6c74ee2 100644 --- a/src/pal/tests/palsuite/c_runtime/sscanf/test9/testinfo.dat +++ b/src/pal/tests/palsuite/c_runtime/sscanf_s/test9/testinfo.dat @@ -4,9 +4,9 @@ Version = 1.0 Section =C Runtime -Function = sscanf -Name = Positive Test for sscanf +Function = sscanf_s +Name = Positive Test for sscanf_s TYPE = DEFAULT EXE1 = test9 Description -= Tests sscanf with characters += Tests sscanf_s with characters diff --git a/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h b/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h index 6e40332fa6..6349b7dcd6 100644 --- a/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h +++ b/src/pal/tests/palsuite/c_runtime/swscanf/swscanf.h @@ -145,8 +145,8 @@ void DoI64NumTest(WCHAR *inputstr, const WCHAR *formatstr, INT64 checknum) if (checknum != num) { - sprintf(buf, "%I64d", num); - sprintf(check, "%I64d", checknum); + sprintf_s(buf, _countof(buf), "%I64d", num); + sprintf_s(check, _countof(check), "%I64d", checknum); Fail("ERROR: scanned I64 number incorrectly from \"%s\" using \"%s\".\n" "Expected %s, got %s.\n", convertC(inputstr), convertC(formatstr), check, buf); diff --git a/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.cpp index 789eebf5a3..e9a79d3880 100644 --- a/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.cpp +++ b/src/pal/tests/palsuite/c_runtime/wcscat/test1/test1.cpp @@ -18,7 +18,7 @@ #include /* - * Notes: uses memcmp and the (pal) sprintf + * Notes: uses memcmp and the (pal) sprintf_s */ int __cdecl main(int argc, char *argv[]) @@ -60,7 +60,7 @@ int __cdecl main(int argc, char *argv[]) if (memcmp(dest, test, sizeof(test)) != 0) { - sprintf(buffer, "%S", dest); + sprintf_s(buffer, _countof(buffer), "%S", dest); Fail("ERROR: Expected wcscat to give \"%s\", got \"%s\"\n", "foo bar baz", buffer); } diff --git a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.cpp index 4e45c86516..2ecafa8307 100644 --- a/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.cpp +++ b/src/pal/tests/palsuite/c_runtime/wcscpy/test1/test1.cpp @@ -15,7 +15,7 @@ #include /* - * Notes: uses memcmp and sprintf. + * Notes: uses memcmp and sprintf_s. */ int __cdecl main(int argc, char *argv[]) @@ -37,7 +37,7 @@ int __cdecl main(int argc, char *argv[]) if (ret != dest || memcmp(dest, result, sizeof(result)) != 0) { - sprintf(buffer, "%S", dest); + sprintf_s(buffer, _countof(buffer), "%S", dest); Fail("Expected wcscpy to give \"%s\" with a return value of %p, got \"%s\" " "with a return value of %p.\n", "foo", dest, buffer, ret); } diff --git a/src/pal/tests/palsuite/common/palsuite.h b/src/pal/tests/palsuite/common/palsuite.h index 459a730806..b77ca2ead5 100644 --- a/src/pal/tests/palsuite/common/palsuite.h +++ b/src/pal/tests/palsuite/common/palsuite.h @@ -133,7 +133,7 @@ inline ULONG VAL32(ULONG x) #define th_htons(w) (((w) >> 8) | ((w) << 8)) #endif // BIGENDIAN - +#define _countof(_array) (sizeof(_array)/sizeof(_array[0])) WCHAR* convert(const char * aString) { diff --git a/src/pal/tests/palsuite/debug_api/WriteProcessMemory/test1/test1.cpp b/src/pal/tests/palsuite/debug_api/WriteProcessMemory/test1/test1.cpp index 060945f8fe..f390c10c72 100644 --- a/src/pal/tests/palsuite/debug_api/WriteProcessMemory/test1/test1.cpp +++ b/src/pal/tests/palsuite/debug_api/WriteProcessMemory/test1/test1.cpp @@ -67,7 +67,7 @@ int __cdecl main(int argc, char *argv[]) ResetEvent(hEvFromHelper); ResetEvent(hEvToHelper); - if (!sprintf(cmdComposeBuf, "helper %s", commsFileName)) + if (!sprintf_s(cmdComposeBuf, _countof(cmdComposeBuf), "helper %s", commsFileName)) { Fail("Could not convert command line\n"); } diff --git a/src/pal/tests/palsuite/debug_api/WriteProcessMemory/test3/test3.cpp b/src/pal/tests/palsuite/debug_api/WriteProcessMemory/test3/test3.cpp index e0218f3267..15b4b3f79d 100644 --- a/src/pal/tests/palsuite/debug_api/WriteProcessMemory/test3/test3.cpp +++ b/src/pal/tests/palsuite/debug_api/WriteProcessMemory/test3/test3.cpp @@ -67,7 +67,7 @@ int __cdecl main(int argc, char *argv[]) "(already exists!)\n", szcFromHelperEvName); } - if (!sprintf(cmdComposeBuf, "helper %s", commsFileName)) + if (!sprintf_s(cmdComposeBuf, _countof(cmdComposeBuf), "helper %s", commsFileName)) { Fail("Could not convert command line\n"); } diff --git a/src/pal/tests/palsuite/file_io/CreateDirectoryA/test1/CreateDirectoryA.cpp b/src/pal/tests/palsuite/file_io/CreateDirectoryA/test1/CreateDirectoryA.cpp index 2bb441e732..4082d38b36 100644 --- a/src/pal/tests/palsuite/file_io/CreateDirectoryA/test1/CreateDirectoryA.cpp +++ b/src/pal/tests/palsuite/file_io/CreateDirectoryA/test1/CreateDirectoryA.cpp @@ -254,7 +254,7 @@ int __cdecl main(int argc, char *argv[]) /* directories with dots */ memset(szDirName, 0, buf_size); - sprintf(szDirName, szDotDir); + sprintf_s(szDirName, _countof(szDirName), szDotDir); bRc = CreateDirectoryA(szDirName, NULL); if (bRc == FALSE) { diff --git a/src/pal/tests/palsuite/file_io/CreateDirectoryW/test1/CreateDirectoryW.cpp b/src/pal/tests/palsuite/file_io/CreateDirectoryW/test1/CreateDirectoryW.cpp index 9b020cc19c..bbaedda745 100644 --- a/src/pal/tests/palsuite/file_io/CreateDirectoryW/test1/CreateDirectoryW.cpp +++ b/src/pal/tests/palsuite/file_io/CreateDirectoryW/test1/CreateDirectoryW.cpp @@ -289,7 +289,7 @@ int __cdecl main(int argc, char *argv[]) /* directories with dots */ memset(szDirName, 0, 252); - sprintf(szDirName, ".dotDirectory"); + sprintf_s(szDirName, _countof(szDirName), ".dotDirectory"); pTemp = convert(szDirName); bRc = CreateDirectoryW(pTemp, NULL); if (bRc == FALSE) diff --git a/src/pal/tests/palsuite/file_io/CreateFileA/test1/CreateFileA.cpp b/src/pal/tests/palsuite/file_io/CreateFileA/test1/CreateFileA.cpp index a70867a5c8..f98fc5b9c5 100644 --- a/src/pal/tests/palsuite/file_io/CreateFileA/test1/CreateFileA.cpp +++ b/src/pal/tests/palsuite/file_io/CreateFileA/test1/CreateFileA.cpp @@ -21,7 +21,7 @@ BOOL Cleanup(void) // loop through all accesses, modes, dispositions and flags for (i=0; i<4*8*4*5; ++i) { - sprintf(FileName, "test%03d.txt", i); + sprintf_s(FileName, _countof(FileName), "test%03d.txt", i); if (DeleteFileA(FileName) == FALSE) { if (GetLastError() != ERROR_FILE_NOT_FOUND) { bRet = FALSE; @@ -98,7 +98,7 @@ int __cdecl main(int argc, char *argv[]) // creation disp loop for (l = 0; l < 5; l++) { - sprintf(lpFileName, "test%03d.txt", nCounter); + sprintf_s(lpFileName, _countof(lpFileName), "test%03d.txt", nCounter); hFile = CreateFile(lpFileName, dwDesiredAccess[i], dwShareMode[j], diff --git a/src/pal/tests/palsuite/file_io/CreateFileW/test1/CreateFileW.cpp b/src/pal/tests/palsuite/file_io/CreateFileW/test1/CreateFileW.cpp index 4d7d20af29..0619f5b4aa 100644 --- a/src/pal/tests/palsuite/file_io/CreateFileW/test1/CreateFileW.cpp +++ b/src/pal/tests/palsuite/file_io/CreateFileW/test1/CreateFileW.cpp @@ -21,7 +21,7 @@ BOOL Cleanup(void) // loop through all accesses, modes, dispositions and flags for (i=0; i<4*8*4*5; ++i) { - sprintf(FileName, "test%03d.txt", i); + sprintf_s(FileName, _countof(FileName), "test%03d.txt", i); if (DeleteFileA(FileName) == FALSE) { if (GetLastError() != ERROR_FILE_NOT_FOUND) { bRet = FALSE; @@ -99,7 +99,7 @@ int __cdecl main(int argc, char *argv[]) // creation disp loop for (l = 0; l < 5; l++) { - sprintf(string, "test%03d.txt", nCounter); + sprintf_s(string, _countof(string), "test%03d.txt", nCounter); lpFileName = convert(string); hFile = CreateFileW(lpFileName, dwDesiredAccess[i], diff --git a/src/pal/tests/palsuite/file_io/GetTempFileNameA/test1/GetTempFileNameA.cpp b/src/pal/tests/palsuite/file_io/GetTempFileNameA/test1/GetTempFileNameA.cpp index 8ede8bab04..bea8e2776e 100644 --- a/src/pal/tests/palsuite/file_io/GetTempFileNameA/test1/GetTempFileNameA.cpp +++ b/src/pal/tests/palsuite/file_io/GetTempFileNameA/test1/GetTempFileNameA.cpp @@ -104,7 +104,7 @@ int __cdecl main(int argc, char *argv[]) } /* now verify that it only used the first 3 characters of the prefix */ - sprintf(szTempString, "%s\\%s", szDot, szLongValidPrefix); + sprintf_s(szTempString, _countof(szTempString), "%s\\%s", szDot, szLongValidPrefix); if (strncmp(szTempString, szReturnedName, 6) == 0) { Fail("GetTempFileNameA: ERROR -> It appears that an improper prefix " diff --git a/src/pal/tests/palsuite/file_io/MoveFileA/test1/MoveFileA.cpp b/src/pal/tests/palsuite/file_io/MoveFileA/test1/MoveFileA.cpp index 8d1bc0eded..6d1337af03 100644 --- a/src/pal/tests/palsuite/file_io/MoveFileA/test1/MoveFileA.cpp +++ b/src/pal/tests/palsuite/file_io/MoveFileA/test1/MoveFileA.cpp @@ -56,7 +56,7 @@ int createExisting(void) } memset(szBuffer, 0, 100); - sprintf(szBuffer, "%s/test01.txt", lpSource[2]); + sprintf_s(szBuffer, _countof(szBuffer), "%s/test01.txt", lpSource[2]); tempFile = fopen(szBuffer, "w"); if (tempFile != NULL) { @@ -70,7 +70,7 @@ int createExisting(void) } memset(szBuffer, 0, 100); - sprintf(szBuffer, "%s/test02.txt", lpSource[2]); + sprintf_s(szBuffer, _countof(szBuffer), "%s/test02.txt", lpSource[2]); tempFile = fopen(szBuffer, "w"); if (tempFile != NULL) { @@ -184,10 +184,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpSource[2]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpSource[2]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpSource[2]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpSource[2]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpSource[2]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpSource[2], 103); } @@ -200,10 +200,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpSource[3]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpSource[3]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpSource[3]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpSource[3]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpSource[3]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpSource[3], 103); } @@ -216,10 +216,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpDestination[0]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpDestination[0]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[0]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpDestination[0]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[0]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpDestination[0], 103); } @@ -231,10 +231,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpDestination[1]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpDestination[1]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[1]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpDestination[1]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[1]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpDestination[1], 103); } @@ -246,10 +246,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpDestination[2]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpDestination[2]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[2]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpDestination[2]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[2]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpDestination[2], 103); } @@ -261,10 +261,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpDestination[3]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpDestination[3]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[3]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpDestination[3]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[3]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpDestination[3], 103); } diff --git a/src/pal/tests/palsuite/file_io/MoveFileW/test1/MoveFileW.cpp b/src/pal/tests/palsuite/file_io/MoveFileW/test1/MoveFileW.cpp index 58999302d0..8a7fae5983 100644 --- a/src/pal/tests/palsuite/file_io/MoveFileW/test1/MoveFileW.cpp +++ b/src/pal/tests/palsuite/file_io/MoveFileW/test1/MoveFileW.cpp @@ -59,7 +59,7 @@ int createExisting(void) } memset(szBuffer, 0, 100); - sprintf(szBuffer, "%s/test01.txt", lpSource[2]); + sprintf_s(szBuffer, _countof(szBuffer), "%s/test01.txt", lpSource[2]); tempFile = fopen(szBuffer, "w"); if (tempFile != NULL) { @@ -73,7 +73,7 @@ int createExisting(void) } memset(szBuffer, 0, 100); - sprintf(szBuffer, "%s/test02.txt", lpSource[2]); + sprintf_s(szBuffer, _countof(szBuffer), "%s/test02.txt", lpSource[2]); tempFile = fopen(szBuffer, "w"); if (tempFile != NULL) { @@ -186,10 +186,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpSource[2]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpSource[2]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpSource[2]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpSource[2]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpSource[2]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpSource[2], 103); } @@ -202,10 +202,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpSource[3]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpSource[3]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpSource[3]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpSource[3]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpSource[3]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpSource[3], 103); } @@ -218,10 +218,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpDestination[0]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpDestination[0]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[0]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpDestination[0]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[0]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpDestination[0], 103); } @@ -233,10 +233,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpDestination[1]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpDestination[1]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[1]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpDestination[1]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[1]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpDestination[1], 103); } @@ -248,10 +248,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpDestination[2]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpDestination[2]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[2]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpDestination[2]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[2]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpDestination[2], 103); } @@ -263,10 +263,10 @@ void removeAll(void) dwAtt = GetFileAttributesA(lpDestination[3]); if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) ) { - sprintf(szTemp, "%s/test01.txt", lpDestination[3]); + sprintf_s(szTemp, _countof(szTemp), "%s/test01.txt", lpDestination[3]); removeFileHelper(szTemp, 18); - sprintf(szTemp, "%s/test02.txt", lpDestination[3]); + sprintf_s(szTemp, _countof(szTemp), "%s/test02.txt", lpDestination[3]); removeFileHelper(szTemp, 19); removeDirectoryHelper(lpDestination[3], 103); } diff --git a/src/pal/tests/palsuite/file_io/RemoveDirectoryA/test1/RemoveDirectoryA.cpp b/src/pal/tests/palsuite/file_io/RemoveDirectoryA/test1/RemoveDirectoryA.cpp index 167af58163..4eb53d0d0a 100644 --- a/src/pal/tests/palsuite/file_io/RemoveDirectoryA/test1/RemoveDirectoryA.cpp +++ b/src/pal/tests/palsuite/file_io/RemoveDirectoryA/test1/RemoveDirectoryA.cpp @@ -48,7 +48,7 @@ int __cdecl main(int argc, char *argv[]) * remove a directory that does not exist */ szTemp = (char *) malloc (sizeof("test_directory")); - sprintf(szTemp, "test_directory"); + sprintf_s(szTemp, sizeof("test_directory"), "test_directory"); bRc = RemoveDirectoryA(szTemp); if (bRc != FALSE) { @@ -69,7 +69,7 @@ int __cdecl main(int argc, char *argv[]) } char *szSymlinkName = (char *) malloc (sizeof("test_directory_symlink")); - sprintf(szSymlinkName, "test_directory_symlink"); + sprintf_s(szSymlinkName, sizeof("test_directory_symlink"), "test_directory_symlink"); if (symlink(szTemp, szSymlinkName) != 0) { Fail("Error:RemoveDirectoryA: Failed to create a symlink to the directory \"test_directory\".\n"); @@ -140,7 +140,7 @@ int __cdecl main(int argc, char *argv[]) * directories with dots */ memset(szDirName, 0, 252); - sprintf(szDirName, ".dotDirectory"); + sprintf_s(szDirName, _countof(szDirName), ".dotDirectory"); szTemp = (char *) malloc (sizeof(szDirName)); szTemp = strncpy(szTemp, szDirName, strlen(szDirName) + 1); @@ -170,7 +170,7 @@ int __cdecl main(int argc, char *argv[]) * Try calling RemoveDirectory with a file name */ memset(szDirName, 0, 252); - sprintf(szDirName, "removedirectoryw.c"); + sprintf_s(szDirName, _countof(szDirName), "removedirectoryw.c"); szTemp = (char *) malloc (sizeof(szDirName)); szTemp = strncpy(szTemp, szDirName, strlen(szDirName) + 1); @@ -201,7 +201,7 @@ int __cdecl main(int argc, char *argv[]) } /* Create non_empty_dir */ - sprintf( szDirName, "non_empty_dir"); + sprintf_s(szDirName, _countof(szDirName), "non_empty_dir"); szTemp = (char *) malloc (sizeof(szDirName)); szTemp = strncpy(szTemp, szDirName, strlen(szDirName) + 1); bRc = CreateDirectoryA(szTemp, NULL); @@ -229,7 +229,7 @@ int __cdecl main(int argc, char *argv[]) } /* Create sub_dir */ - sprintf (szDirName, "sub_dir"); + sprintf_s(szDirName, _countof(szDirName), "sub_dir"); szTemp2 = (char *) malloc (sizeof(szDirName)); szTemp2 = strncpy(szTemp2, szDirName, strlen(szDirName) + 1); bRc = CreateDirectoryA(szTemp2, NULL); diff --git a/src/pal/tests/palsuite/file_io/RemoveDirectoryW/test1/RemoveDirectoryW.cpp b/src/pal/tests/palsuite/file_io/RemoveDirectoryW/test1/RemoveDirectoryW.cpp index ae1dd0fb97..ec90528069 100644 --- a/src/pal/tests/palsuite/file_io/RemoveDirectoryW/test1/RemoveDirectoryW.cpp +++ b/src/pal/tests/palsuite/file_io/RemoveDirectoryW/test1/RemoveDirectoryW.cpp @@ -114,7 +114,7 @@ int __cdecl main(int argc, char *argv[]) * directories with dots */ memset(szDirName, 0, 252); - sprintf(szDirName, ".dotDirectory"); + sprintf_s(szDirName, _countof(szDirName), ".dotDirectory"); szwTemp = convert(szDirName); bRc = CreateDirectoryW(szwTemp, NULL); if (bRc == FALSE) @@ -142,7 +142,7 @@ int __cdecl main(int argc, char *argv[]) * Try calling RemoveDirectory with a file name */ memset(szDirName, 0, 252); - sprintf(szDirName, "removedirectoryw.c"); + sprintf_s(szDirName, _countof(szDirName), "removedirectoryw.c"); szwTemp = convert(szDirName); bRc = RemoveDirectoryW(szwTemp); diff --git a/src/pal/tests/palsuite/file_io/SearchPathA/test1/SearchPathA.cpp b/src/pal/tests/palsuite/file_io/SearchPathA/test1/SearchPathA.cpp index 8422683301..57afdefc7b 100644 --- a/src/pal/tests/palsuite/file_io/SearchPathA/test1/SearchPathA.cpp +++ b/src/pal/tests/palsuite/file_io/SearchPathA/test1/SearchPathA.cpp @@ -90,7 +90,7 @@ int __cdecl main(int argc, char *argv[]) { } memset(fileloc, 0, _MAX_PATH); - sprintf(fileloc, "%s%s", fullPath, szFileNameExistsWithExt); + sprintf_s(fileloc, _countof(fileloc), "%s%s", fullPath, szFileNameExistsWithExt); RemoveAll(); diff --git a/src/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp b/src/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp index 1c8adba5ac..6880a864cb 100644 --- a/src/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp +++ b/src/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp @@ -133,7 +133,7 @@ int __cdecl main(int argc, char *argv[]) { } memset(fileloc, 0, _MAX_PATH); - sprintf(fileloc, "%s%s", fullPath, szFileNameExistsWithExt); + sprintf_s(fileloc, _countof(fileloc), "%s%s", fullPath, szFileNameExistsWithExt); RemoveAll(); diff --git a/src/pal/tests/palsuite/file_io/SetCurrentDirectoryA/test1/SetCurrentDirectoryA.cpp b/src/pal/tests/palsuite/file_io/SetCurrentDirectoryA/test1/SetCurrentDirectoryA.cpp index c07a62412b..f227aa3268 100644 --- a/src/pal/tests/palsuite/file_io/SetCurrentDirectoryA/test1/SetCurrentDirectoryA.cpp +++ b/src/pal/tests/palsuite/file_io/SetCurrentDirectoryA/test1/SetCurrentDirectoryA.cpp @@ -118,9 +118,9 @@ int __cdecl main(int argc, char *argv[]) /* append the temp name to the "home" directory */ memset(szBuiltDir, 0, (_MAX_DIR+1)); #if WIN32 - sprintf(szBuiltDir,"%s%s\\", szHomeDir, szDirName); + sprintf_s(szBuiltDir, _countof(szBuiltDir),"%s%s\\", szHomeDir, szDirName); #else - sprintf(szBuiltDir,"%s%s/", szHomeDir, szDirName); + sprintf_s(szBuiltDir, _countof(szBuiltDir),"%s%s/", szHomeDir, szDirName); #endif /* get the new current directory */ diff --git a/src/pal/tests/palsuite/file_io/SetCurrentDirectoryA/test2/setcurrentdirectorya.cpp b/src/pal/tests/palsuite/file_io/SetCurrentDirectoryA/test2/setcurrentdirectorya.cpp index 415dbbf045..4b1c1c8790 100644 --- a/src/pal/tests/palsuite/file_io/SetCurrentDirectoryA/test2/setcurrentdirectorya.cpp +++ b/src/pal/tests/palsuite/file_io/SetCurrentDirectoryA/test2/setcurrentdirectorya.cpp @@ -62,9 +62,9 @@ int __cdecl main(int argc, char *argv[]) /* append the temp name to the "home" directory */ memset(szBuiltDir, 0, (_MAX_DIR+1)); #if WIN32 - sprintf(szBuiltDir,"%s\\..\\", szDirName); + sprintf_s(szBuiltDir, _countof(szBuiltDir),"%s\\..\\", szDirName); #else - sprintf(szBuiltDir,"%s/../", szDirName); + sprintf_s(szBuiltDir, _countof(szBuiltDir),"%s/../", szDirName); #endif diff --git a/src/pal/tests/palsuite/file_io/SetCurrentDirectoryW/test2/setcurrentdirectoryw.cpp b/src/pal/tests/palsuite/file_io/SetCurrentDirectoryW/test2/setcurrentdirectoryw.cpp index 7e3d7b785f..7f833baabc 100644 --- a/src/pal/tests/palsuite/file_io/SetCurrentDirectoryW/test2/setcurrentdirectoryw.cpp +++ b/src/pal/tests/palsuite/file_io/SetCurrentDirectoryW/test2/setcurrentdirectoryw.cpp @@ -63,9 +63,9 @@ int __cdecl main(int argc, char *argv[]) /* append the temp name to the "home" directory */ memset(szBuiltDir, 0, MAX_PATH); #if WIN32 - sprintf(szBuiltDir,"%s\\..\\", szDirName); + sprintf_s(szBuiltDir, _countof(szBuiltDir),"%s\\..\\", szDirName); #else - sprintf(szBuiltDir,"%s/../", szDirName); + sprintf_s(szBuiltDir, _countof(szBuiltDir),"%s/../", szDirName); #endif szwBuiltDir = convert(szBuiltDir); diff --git a/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test2/CreateFileMappingW.cpp b/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test2/CreateFileMappingW.cpp index 11ff967dfd..5cc6d77709 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test2/CreateFileMappingW.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test2/CreateFileMappingW.cpp @@ -34,9 +34,9 @@ int __cdecl main(int argc, char *argv[]) } #if WIN32 - sprintf(executableFileName,"%s","executable.exe"); + sprintf_s(executableFileName, _countof(executableFileName),"%s","executable.exe"); #else - sprintf(executableFileName,"%s","executable"); + sprintf_s(executableFileName, _countof(executableFileName),"%s","executable"); #endif //conver string to a unicode one diff --git a/src/pal/tests/palsuite/filemapping_memmgt/ReadProcessMemory/test2/test2.cpp b/src/pal/tests/palsuite/filemapping_memmgt/ReadProcessMemory/test2/test2.cpp index 91172be9e1..3aea80e1f1 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/ReadProcessMemory/test2/test2.cpp +++ b/src/pal/tests/palsuite/filemapping_memmgt/ReadProcessMemory/test2/test2.cpp @@ -73,7 +73,7 @@ int __cdecl main(int argc, char *argv[]) ResetEvent(hEvFromHelper); ResetEvent(hEvToHelper); - if (!sprintf(cmdComposeBuf, "helper %s", commsFileName)) + if (!sprintf_s(cmdComposeBuf, _countof(cmdComposeBuf), "helper %s", commsFileName)) { Fail("Could not convert command line\n"); } @@ -138,7 +138,7 @@ int __cdecl main(int argc, char *argv[]) errno, GetLastError()); } PEDANTIC1(fclose,(commsFile)); - sscanf(incomingCMDBuffer, LLFORMAT " " LLFORMAT, &pDestMemory, &Count); + sscanf_s(incomingCMDBuffer, LLFORMAT " " LLFORMAT, &pDestMemory, &Count); if (argc > 1) { Trace("Preparing to write to " LLFORMAT " bytes @ " LLFORMAT "('%s')\n", diff --git a/src/pal/tests/palsuite/loader/LoadLibraryA/test5/loadlibrarya.cpp b/src/pal/tests/palsuite/loader/LoadLibraryA/test5/loadlibrarya.cpp index d1e6b6d1dc..ab38d1a632 100644 --- a/src/pal/tests/palsuite/loader/LoadLibraryA/test5/loadlibrarya.cpp +++ b/src/pal/tests/palsuite/loader/LoadLibraryA/test5/loadlibrarya.cpp @@ -31,10 +31,10 @@ int __cdecl main(int argc, char *argv[]) /*Module name without extension but with a trailing dot*/ #if WIN32 - sprintf(ModuleName, "%s", "rotor_pal."); + sprintf_s(ModuleName, _countof(ModuleName), "%s", "rotor_pal."); #else /* Under FreeBSD */ - sprintf(ModuleName, "%s", "librotor_pal."); + sprintf_s(ModuleName, _countof(ModuleName), "%s", "librotor_pal."); #endif /* load a module which does not have the file extension, diff --git a/src/pal/tests/palsuite/loader/LoadLibraryW/test5/loadlibraryw.cpp b/src/pal/tests/palsuite/loader/LoadLibraryW/test5/loadlibraryw.cpp index acaa200a06..6d92f029e4 100644 --- a/src/pal/tests/palsuite/loader/LoadLibraryW/test5/loadlibraryw.cpp +++ b/src/pal/tests/palsuite/loader/LoadLibraryW/test5/loadlibraryw.cpp @@ -33,9 +33,9 @@ int __cdecl main(int argc, char *argv[]) /*Module name without extension but with a trailing dot*/ #if WIN32 - sprintf(ModuleName,"%s","rotor_pal."); + sprintf_s(ModuleName, _countof(ModuleName),"%s","rotor_pal."); #else - sprintf(ModuleName,"%s","librotor_pal."); + sprintf_s(ModuleName, _countof(ModuleName),"%s","librotor_pal."); #endif /* convert a normal string to a wide one */ diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/PAL_RegisterLibraryW_UnregisterLibraryW.cpp b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/PAL_RegisterLibraryW_UnregisterLibraryW.cpp index ff0d33879c..8eb8776107 100644 --- a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/PAL_RegisterLibraryW_UnregisterLibraryW.cpp +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/PAL_RegisterLibraryW_UnregisterLibraryW.cpp @@ -33,7 +33,7 @@ int __cdecl main(int argc, char *argv[]) /*zero the buffer*/ memset(ModuleName,0,64); - sprintf(ModuleName, "%s", "rotor_pal"); + sprintf_s(ModuleName, _countof(ModuleName), "%s", "rotor_pal"); /*convert a normal string to a wide one*/ wpModuleName = convert(ModuleName); diff --git a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.cpp b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.cpp index a15ff5745b..c6fa4ad074 100644 --- a/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.cpp +++ b/src/pal/tests/palsuite/pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/reg_unreg_libraryw_neg.cpp @@ -30,7 +30,7 @@ int __cdecl main(int argc, char *argv[]) } memset(ModuleName, 0, 64); - sprintf(ModuleName, "%s", "not_exist_module_name"); + sprintf_s(ModuleName, _countof(ModuleName), "%s", "not_exist_module_name"); /*convert a normal string to a wide one*/ wpModuleName = convert(ModuleName); diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt index d9af111b25..a5e241d397 100644 --- a/src/pal/tests/palsuite/paltestlist.txt +++ b/src/pal/tests/palsuite/paltestlist.txt @@ -143,44 +143,43 @@ c_runtime/sin/test1/paltest_sin_test1 c_runtime/sinf/test1/paltest_sinf_test1 c_runtime/sinh/test1/paltest_sinh_test1 c_runtime/sinhf/test1/paltest_sinhf_test1 -c_runtime/sprintf/test1/paltest_sprintf_test1 -c_runtime/sprintf/test10/paltest_sprintf_test10 -c_runtime/sprintf/test11/paltest_sprintf_test11 -c_runtime/sprintf/test12/paltest_sprintf_test12 -c_runtime/sprintf/test13/paltest_sprintf_test13 -c_runtime/sprintf/test14/paltest_sprintf_test14 -c_runtime/sprintf/test15/paltest_sprintf_test15 -c_runtime/sprintf/test16/paltest_sprintf_test16 -c_runtime/sprintf/test17/paltest_sprintf_test17 -c_runtime/sprintf/test18/paltest_sprintf_test18 -c_runtime/sprintf/test19/paltest_sprintf_test19 -c_runtime/sprintf/test2/paltest_sprintf_test2 -c_runtime/sprintf/test3/paltest_sprintf_test3 -c_runtime/sprintf/test4/paltest_sprintf_test4 -c_runtime/sprintf/test5/paltest_sprintf_test5 -c_runtime/sprintf/test6/paltest_sprintf_test6 -c_runtime/sprintf/test7/paltest_sprintf_test7 -c_runtime/sprintf/test8/paltest_sprintf_test8 -c_runtime/sprintf/test9/paltest_sprintf_test9 +c_runtime/sprintf_s/test1/paltest_sprintf_test1 +c_runtime/sprintf_s/test10/paltest_sprintf_test10 +c_runtime/sprintf_s/test11/paltest_sprintf_test11 +c_runtime/sprintf_s/test12/paltest_sprintf_test12 +c_runtime/sprintf_s/test13/paltest_sprintf_test13 +c_runtime/sprintf_s/test14/paltest_sprintf_test14 +c_runtime/sprintf_s/test15/paltest_sprintf_test15 +c_runtime/sprintf_s/test16/paltest_sprintf_test16 +c_runtime/sprintf_s/test17/paltest_sprintf_test17 +c_runtime/sprintf_s/test18/paltest_sprintf_test18 +c_runtime/sprintf_s/test19/paltest_sprintf_test19 +c_runtime/sprintf_s/test2/paltest_sprintf_test2 +c_runtime/sprintf_s/test3/paltest_sprintf_test3 +c_runtime/sprintf_s/test4/paltest_sprintf_test4 +c_runtime/sprintf_s/test6/paltest_sprintf_test6 +c_runtime/sprintf_s/test7/paltest_sprintf_test7 +c_runtime/sprintf_s/test8/paltest_sprintf_test8 +c_runtime/sprintf_s/test9/paltest_sprintf_test9 c_runtime/sqrt/test1/paltest_sqrt_test1 c_runtime/sqrtf/test1/paltest_sqrtf_test1 -c_runtime/sscanf/test1/paltest_sscanf_test1 -c_runtime/sscanf/test10/paltest_sscanf_test10 -c_runtime/sscanf/test11/paltest_sscanf_test11 -c_runtime/sscanf/test12/paltest_sscanf_test12 -c_runtime/sscanf/test13/paltest_sscanf_test13 -c_runtime/sscanf/test14/paltest_sscanf_test14 -c_runtime/sscanf/test15/paltest_sscanf_test15 -c_runtime/sscanf/test16/paltest_sscanf_test16 -c_runtime/sscanf/test17/paltest_sscanf_test17 -c_runtime/sscanf/test2/paltest_sscanf_test2 -c_runtime/sscanf/test3/paltest_sscanf_test3 -c_runtime/sscanf/test4/paltest_sscanf_test4 -c_runtime/sscanf/test5/paltest_sscanf_test5 -c_runtime/sscanf/test6/paltest_sscanf_test6 -c_runtime/sscanf/test7/paltest_sscanf_test7 -c_runtime/sscanf/test8/paltest_sscanf_test8 -c_runtime/sscanf/test9/paltest_sscanf_test9 +c_runtime/sscanf_s/test1/paltest_sscanf_test1 +c_runtime/sscanf_s/test10/paltest_sscanf_test10 +c_runtime/sscanf_s/test11/paltest_sscanf_test11 +c_runtime/sscanf_s/test12/paltest_sscanf_test12 +c_runtime/sscanf_s/test13/paltest_sscanf_test13 +c_runtime/sscanf_s/test14/paltest_sscanf_test14 +c_runtime/sscanf_s/test15/paltest_sscanf_test15 +c_runtime/sscanf_s/test16/paltest_sscanf_test16 +c_runtime/sscanf_s/test17/paltest_sscanf_test17 +c_runtime/sscanf_s/test2/paltest_sscanf_test2 +c_runtime/sscanf_s/test3/paltest_sscanf_test3 +c_runtime/sscanf_s/test4/paltest_sscanf_test4 +c_runtime/sscanf_s/test5/paltest_sscanf_test5 +c_runtime/sscanf_s/test6/paltest_sscanf_test6 +c_runtime/sscanf_s/test7/paltest_sscanf_test7 +c_runtime/sscanf_s/test8/paltest_sscanf_test8 +c_runtime/sscanf_s/test9/paltest_sscanf_test9 c_runtime/strcat/test1/paltest_strcat_test1 c_runtime/strchr/test1/paltest_strchr_test1 c_runtime/strcmp/test1/paltest_strcmp_test1 diff --git a/src/pal/tests/palsuite/palverify.dat b/src/pal/tests/palsuite/palverify.dat index e7bfd60aed..d6e113b670 100644 --- a/src/pal/tests/palsuite/palverify.dat +++ b/src/pal/tests/palsuite/palverify.dat @@ -271,44 +271,43 @@ c_runtime/sin/test1,1 c_runtime/sinf/test1,1 c_runtime/sinh/test1,1 c_runtime/sinhf/test1,1 -c_runtime/sprintf/test1,1 -c_runtime/sprintf/test2,1 -c_runtime/sprintf/test3,1 -c_runtime/sprintf/test4,1 -c_runtime/sprintf/test5,1 -c_runtime/sprintf/test6,1 -c_runtime/sprintf/test7,1 -c_runtime/sprintf/test8,1 -c_runtime/sprintf/test9,1 -c_runtime/sprintf/test10,1 -c_runtime/sprintf/test11,1 -c_runtime/sprintf/test12,1 -c_runtime/sprintf/test13,1 -c_runtime/sprintf/test14,1 -c_runtime/sprintf/test15,1 -c_runtime/sprintf/test16,1 -c_runtime/sprintf/test17,1 -c_runtime/sprintf/test18,1 -c_runtime/sprintf/test19,1 +c_runtime/sprintf_s/test1,1 +c_runtime/sprintf_s/test2,1 +c_runtime/sprintf_s/test3,1 +c_runtime/sprintf_s/test4,1 +c_runtime/sprintf_s/test6,1 +c_runtime/sprintf_s/test7,1 +c_runtime/sprintf_s/test8,1 +c_runtime/sprintf_s/test9,1 +c_runtime/sprintf_s/test10,1 +c_runtime/sprintf_s/test11,1 +c_runtime/sprintf_s/test12,1 +c_runtime/sprintf_s/test13,1 +c_runtime/sprintf_s/test14,1 +c_runtime/sprintf_s/test15,1 +c_runtime/sprintf_s/test16,1 +c_runtime/sprintf_s/test17,1 +c_runtime/sprintf_s/test18,1 +c_runtime/sprintf_s/test19,1 c_runtime/sqrt/test1,1 c_runtime/sqrtf/test1,1 -c_runtime/sscanf/test1,1 -c_runtime/sscanf/test2,1 -c_runtime/sscanf/test3,1 -c_runtime/sscanf/test4,1 -c_runtime/sscanf/test5,1 -c_runtime/sscanf/test6,1 -c_runtime/sscanf/test7,1 -c_runtime/sscanf/test8,1 -c_runtime/sscanf/test9,1 -c_runtime/sscanf/test10,1 -c_runtime/sscanf/test11,1 -c_runtime/sscanf/test12,1 -c_runtime/sscanf/test13,1 -c_runtime/sscanf/test14,1 -c_runtime/sscanf/test15,1 -c_runtime/sscanf/test16,1 -c_runtime/sscanf/test17,1 +c_runtime/sscanf_s/test1,1 +c_runtime/sscanf_s/test2,1 +c_runtime/sscanf_s/test3,1 +c_runtime/sscanf_s/test4,1 +c_runtime/sscanf_s/test5,1 +c_runtime/sscanf_s/test6,1 +c_runtime/sscanf_s/test7,1 +c_runtime/sscanf_s/test8,1 +c_runtime/sscanf_s/test9,1 +c_runtime/sscanf_s/test10,1 +c_runtime/sscanf_s/test11,1 +c_runtime/sscanf_s/test12,1 +c_runtime/sscanf_s/test13,1 +c_runtime/sscanf_s/test14,1 +c_runtime/sscanf_s/test15,1 +c_runtime/sscanf_s/test16,1 +c_runtime/sscanf_s/test17,1 c_runtime/strcat/test1,1 c_runtime/strchr/test1,1 c_runtime/strcmp/test1,1 diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp index b7fc67cd24..34da344c94 100644 --- a/src/vm/appdomain.cpp +++ b/src/vm/appdomain.cpp @@ -11144,14 +11144,14 @@ void AppDomain::Unload(BOOL fForceUnload) if (takeSnapShot) { char buffer[1024]; - sprintf(buffer, "vadump -p %d -o > vadump.%d", GetCurrentProcessId(), unloadCount); + sprintf_s(buffer, _countof(buffer), "vadump -p %d -o > vadump.%d", GetCurrentProcessId(), unloadCount); system(buffer); - sprintf(buffer, "umdh -p:%d -d -i:1 -f:umdh.%d", GetCurrentProcessId(), unloadCount); + sprintf_s(buffer, _countof(buffer), "umdh -p:%d -d -i:1 -f:umdh.%d", GetCurrentProcessId(), unloadCount); system(buffer); int takeDHSnapShot = CLRConfig::GetConfigValue(CLRConfig::INTERNAL_ADTakeDHSnapShot); if (takeDHSnapShot) { - sprintf(buffer, "dh -p %d -s -g -h -b -f dh.%d", GetCurrentProcessId(), unloadCount); + sprintf_s(buffer, _countof(buffer), "dh -p %d -s -g -h -b -f dh.%d", GetCurrentProcessId(), unloadCount); system(buffer); } } diff --git a/src/vm/compile.cpp b/src/vm/compile.cpp index 721005efd9..87107151eb 100644 --- a/src/vm/compile.cpp +++ b/src/vm/compile.cpp @@ -5453,7 +5453,7 @@ static BOOL CanSatisfyConstraints(Instantiation typicalInst, Instantiation candi StackScratchBuffer buffer; thArg.GetName(candidateInstName); char output[1024]; - sprintf(output, "Generics TypeDependencyAttribute processing: Couldn't satisfy a constraint. Class with Attribute: %s Bad candidate instantiated type: %s\r\n", pMT->GetDebugClassName(), candidateInstName.GetANSI(buffer)); + _snprintf_s(output, _countof(output), _TRUNCATE, "Generics TypeDependencyAttribute processing: Couldn't satisfy a constraint. Class with Attribute: %s Bad candidate instantiated type: %s\r\n", pMT->GetDebugClassName(), candidateInstName.GetANSI(buffer)); OutputDebugStringA(output); */ #endif diff --git a/src/vm/gdbjit.cpp b/src/vm/gdbjit.cpp index 9a160263ce..3dae8485d1 100644 --- a/src/vm/gdbjit.cpp +++ b/src/vm/gdbjit.cpp @@ -1471,11 +1471,12 @@ void NotifyGdb::MethodCompiled(MethodDesc* MethodDescPtr) method[method_index]->GetLocalsDebugInfo(pTypeMap, locals, symInfo[firstLineIndex].nativeOffset); method[method_index]->m_sub_low_pc = pCode + method_start; method[method_index]->m_sub_high_pc = method_size; - method[method_index]->m_member_name = new char[strlen(methodName) + 10]; + size_t methodNameSize = strlen(methodName) + 10; + method[method_index]->m_member_name = new char[methodNameSize]; if (method_index == 0) - sprintf(method[method_index]->m_member_name, "%s", methodName); + sprintf_s(method[method_index]->m_member_name, methodNameSize, "%s", methodName); else - sprintf(method[method_index]->m_member_name, "%s_%i", methodName, method_index); + sprintf_s(method[method_index]->m_member_name, methodNameSize, "%s_%i", methodName, method_index); // method's class GetTypeInfoFromTypeHandle(TypeHandle(method[method_index]->md->GetMethodTable()), pTypeMap); @@ -2168,7 +2169,7 @@ bool NotifyGdb::CollectCalledMethods(CalledMethod* pCalledMethods) int symbolNameLength = strlen(methodName) + sizeof("__thunk_"); SymbolNames[i].m_name = new char[symbolNameLength]; SymbolNames[i].m_releaseName = true; - sprintf((char*)SymbolNames[i].m_name, "__thunk_%s", methodName); + sprintf_s((char*)SymbolNames[i].m_name, symbolNameLength, "__thunk_%s", methodName); SymbolNames[i].m_value = callAddr; ++i; codeAddrs.Add(callAddr); @@ -2300,7 +2301,7 @@ bool NotifyGdb::BuildSectionTables(MemBuf& sectBuf, MemBuf& strBuf) bool isThunkSection = i >= SectionNamesCount; if (isThunkSection) { - sprintf(thunkSectNameBuf, ".thunk_%i", i); + sprintf_s(thunkSectNameBuf, _countof(thunkSectNameBuf), ".thunk_%i", i); sectName = thunkSectNameBuf; } else -- 2.34.1