Skip to content

Commit 9f7531d

Browse files
authored
Merge pull request #21009 from mikeash/keypath-allocation-overflow-fix-5.0
[5.0][Stdlib] Ensure key paths allocate space for the terminating NUL.
2 parents 40316ca + cb07bfd commit 9f7531d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

stdlib/public/core/KeyPath.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2099,7 +2099,7 @@ internal func _appendingKeyPaths<
20992099
rootKVCLength = Int(_swift_stdlib_strlen(rootPtr))
21002100
leafKVCLength = Int(_swift_stdlib_strlen(leafPtr))
21012101
// root + "." + leaf
2102-
appendedKVCLength = rootKVCLength + 1 + leafKVCLength
2102+
appendedKVCLength = rootKVCLength + 1 + leafKVCLength + 1
21032103
} else {
21042104
rootKVCLength = 0
21052105
leafKVCLength = 0

0 commit comments

Comments
 (0)