Skip to content

Commit b5b008f

Browse files
authored
Replace strcpy -> strlcpy in swift_getTupleTypeMetadata (#39181)
1 parent 8e4054f commit b5b008f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/public/runtime/Metadata.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include "swift/Runtime/HeapObject.h"
2828
#include "swift/Runtime/Mutex.h"
2929
#include "swift/Runtime/Once.h"
30+
#include "swift/Runtime/Portability.h"
3031
#include "swift/Strings.h"
3132
#include "llvm/ADT/StringExtras.h"
3233
#include <algorithm>
@@ -1861,7 +1862,7 @@ swift::swift_getTupleTypeMetadata(MetadataRequest request,
18611862
size_t labelsAllocSize = roundUpToAlignment(labelsLen + 1, sizeof(void*));
18621863
char *newLabels =
18631864
(char *) MetadataAllocator(TupleCacheTag).Allocate(labelsAllocSize, alignof(char));
1864-
strcpy(newLabels, labels);
1865+
_swift_strlcpy(newLabels, labels, labelsAllocSize);
18651866
key.Labels = newLabels;
18661867

18671868
// Update the metadata cache.

0 commit comments

Comments
 (0)