Skip to content

Commit 9b5556e

Browse files
committed
Swift: Test 'completePath' more carefully.
1 parent 2d313ef commit 9b5556e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

swift/ql/test/query-tests/Security/CWE-022/testPathInjection.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,12 +471,15 @@ func testPathInjection2(s1: UnsafeMutablePointer<String>, s2: UnsafeMutablePoint
471471
_ = NSData().write(toFile: s1.pointee, atomically: true)
472472
s1.pointee = remoteString
473473
_ = NSData().write(toFile: s1.pointee, atomically: true) // $ hasPathInjection=445
474+
_ = NSData().write(toFile: s1[0], atomically: true) // $ MISSING: hasPathInjection=445
474475

475476
_ = "".completePath(into: s2, caseSensitive: false, matchesInto: nil, filterTypes: nil)
476477
_ = NSData().write(toFile: s2.pointee, atomically: true)
478+
_ = NSData().write(toFile: s2[0], atomically: true)
477479

478480
_ = remoteString.completePath(into: s3, caseSensitive: false, matchesInto: nil, filterTypes: nil)
479481
_ = NSData().write(toFile: s3.pointee, atomically: true) // $ MISSING: hasPathInjection=445
482+
_ = NSData().write(toFile: s3[0], atomically: true) // $ MISSING: hasPathInjection=445
480483

481484
_ = fm.fileAttributes(atPath: remoteString, traverseLink: true) // $ hasPathInjection=445
482485
_ = try fm.attributesOfItem(atPath: remoteString) // $ hasPathInjection=445

0 commit comments

Comments
 (0)