We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 25bcfed + cab1f40 commit 0af5839Copy full SHA for 0af5839
stdlib/public/Concurrency/TaskStatus.cpp
@@ -654,8 +654,13 @@ void AsyncTask::pushInitialTaskName(const char* _taskName) {
654
auto taskNameLen = strlen(_taskName);
655
char* taskNameCopy = reinterpret_cast<char*>(
656
_swift_task_alloc_specific(this, taskNameLen + 1/*null terminator*/));
657
+#if defined(_WIN32)
658
+ static_cast<void>(strncpy_s(taskNameCopy, taskNameLen + 1,
659
+ _taskName, _TRUNCATE));
660
+#else
661
(void) strncpy(/*dst=*/taskNameCopy, /*src=*/_taskName, taskNameLen);
662
taskNameCopy[taskNameLen] = '\0'; // make sure we null-terminate
663
+#endif
664
665
auto record =
666
::new (allocation) TaskNameStatusRecord(taskNameCopy);
0 commit comments