Skip to content

Commit c4af338

Browse files
committed
Do not use strcpy for Darwin Temp Dir
1 parent 77b49a7 commit c4af338

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

pxr/base/arch/darwin.mm

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//
2-
// Copyright 2025 Pixar
2+
// Copyright 2025 Apple
33
//
44
// Licensed under the terms set forth in the LICENSE.txt file available at
55
// https://openusd.org/license.
@@ -13,13 +13,8 @@
1313

1414

1515
const char* Arch_DarwinGetTemporaryDirectory() {
16-
char* temporaryDirectory;
17-
18-
const char *nsTmpDir = [NSTemporaryDirectory() UTF8String];
19-
temporaryDirectory = new char[strlen(nsTmpDir) + 1];
20-
strcpy(temporaryDirectory, nsTmpDir);
21-
22-
return temporaryDirectory;
16+
std::string tmpDir = [NSTemporaryDirectory() UTF8String];
17+
return tmpDir.c_str();
2318
}
2419

2520
PXR_NAMESPACE_CLOSE_SCOPE

0 commit comments

Comments
 (0)