Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/tests/Common/Platform/platformdefines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,9 @@ error_t TP_putenv_s(LPWSTR name, LPWSTR value)
return 0;
#else
int retVal = 0;
char *assignment = (char*) malloc(sizeof(char) * (TP_slen(name) + TP_slen(value) + 1));
sprintf(assignment, "%s=%s", HackyConvertToSTR(name), HackyConvertToSTR(value));
size_t assignmentSize = sizeof(char) * (TP_slen(name) + TP_slen(value) + 1 + 1);
char *assignment = (char*) malloc(assignmentSize);
snprintf(assignment, assignmentSize, "%s=%s", HackyConvertToSTR(name), HackyConvertToSTR(value));

if (0 != putenv(assignment))
retVal = 2;
Expand Down
4 changes: 2 additions & 2 deletions src/tests/nativeaot/SmokeTests/PInvoke/PInvokeNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,12 @@ DLL_EXPORT bool __stdcall StructTest_Array(NativeSequentialStruct *nss, int leng
return false;
if (nss[i].b != i*i)
return false;
sprintf(expected, "%d", i);
snprintf(expected, sizeof(expected), "%d", i);

if (CompareAnsiString(expected, nss[i].str) == 0)
return false;

sprintf(expected, "u8%d", i);
snprintf(expected, sizeof(expected), "u8%d", i);

if (CompareAnsiString(expected, nss[i].u8str) == 0)
return false;
Expand Down