mirror of
https://github.com/apple/container.git
synced 2026-10-13 09:39:18 +00:00
Prevent recursion attacks in EXT4Formatter.unlink (#415)
This issue doesn't affect any of our existing products. This is a preemptive fix for downstream consumers of EXT4.format where, in some platforms, leading `//` in the path could get resolved into a FileTree that looks like this ```sh / └── / └── usr ```
This commit is contained in:
1 parent
de075fff8a
commit
df125a2300
5 files changed
+282
-30
No files matched your search
@@ -330,12 +330,7 @@ extension Socket {
|
||||
|
||||
var cmsgBuf = [UInt8](repeating: 0, count: Int(CZ_CMSG_SPACE(Int(MemoryLayout<Int32>.size))))
|
||||
msg.msg_control = withUnsafeMutablePointer(to: &cmsgBuf[0]) { UnsafeMutableRawPointer($0) }
|
||||
|
||||
#if canImport(Glibc)
|
||||
msg.msg_controllen = size_t(cmsgBuf.count)
|
||||
#else
|
||||
msg.msg_controllen = socklen_t(cmsgBuf.count)
|
||||
#endif
|
||||
msg.msg_controllen = numericCast(cmsgBuf.count)
|
||||
|
||||
let recvResult = withUnsafeMutablePointer(to: &msg) { msgPtr in
|
||||
sysRecvmsg(handle.fileDescriptor, msgPtr, 0)
|
||||
|
||||
Reference in new issue
Block a user