@@ -35,6 +35,8 @@ struct FileAttributeKey : Hashable {}
35
35
36
36
struct ObjCBool { }
37
37
38
+ struct AutoreleasingUnsafeMutablePointer < Pointee> { }
39
+
38
40
class FileManager {
39
41
class DirectoryEnumerator { }
40
42
struct DirectoryEnumerationOptions : OptionSet { let rawValue : Int }
@@ -105,76 +107,76 @@ func test() {
105
107
let safeUrl = URL ( string: " " ) !
106
108
let safeNsUrl = NSURL ( string: " " ) !
107
109
108
- Data ( " " ) . write ( to: remoteUrl, options: [ ] ) // $ hasPathInjection=102
110
+ Data ( " " ) . write ( to: remoteUrl, options: [ ] ) // $ hasPathInjection=104
109
111
110
112
let nsData = NSData ( )
111
- let _ = nsData. write ( to: remoteUrl, atomically: false ) // $ hasPathInjection=102
112
- nsData. write ( to: remoteUrl, options: [ ] ) // $ hasPathInjection=102
113
- let _ = nsData. write ( toFile: remoteString, atomically: false ) // $ hasPathInjection=102
114
- nsData. write ( toFile: remoteString, options: [ ] ) // $ hasPathInjection=102
113
+ let _ = nsData. write ( to: remoteUrl, atomically: false ) // $ hasPathInjection=104
114
+ nsData. write ( to: remoteUrl, options: [ ] ) // $ hasPathInjection=104
115
+ let _ = nsData. write ( toFile: remoteString, atomically: false ) // $ hasPathInjection=104
116
+ nsData. write ( toFile: remoteString, options: [ ] ) // $ hasPathInjection=104
115
117
116
118
let fm = FileManager ( )
117
- let _ = fm. contentsOfDirectory ( at: remoteUrl, includingPropertiesForKeys: [ ] , options: [ ] ) // $ hasPathInjection=102
118
- let _ = fm. contentsOfDirectory ( atPath: remoteString) // $ hasPathInjection=102
119
- let _ = fm. enumerator ( at: remoteUrl, includingPropertiesForKeys: [ ] , options: [ ] , errorHandler: nil ) // $ hasPathInjection=102
120
- let _ = fm. enumerator ( atPath: remoteString) // $ hasPathInjection=102
121
- let _ = fm. subpathsOfDirectory ( atPath: remoteString) // $ hasPathInjection=102
122
- let _ = fm. subpaths ( atPath: remoteString) // $ hasPathInjection=102
123
- fm. createDirectory ( at: remoteUrl, withIntermediateDirectories: false , attributes: [ : ] ) // $ hasPathInjection=102
124
- let _ = fm. createDirectory ( atPath: remoteString, attributes: [ : ] ) // $ hasPathInjection=102
125
- let _ = fm. createFile ( atPath: remoteString, contents: nil , attributes: [ : ] ) // $ hasPathInjection=102
126
- fm. removeItem ( at: remoteUrl) // $ hasPathInjection=102
127
- fm. removeItem ( atPath: remoteString) // $ hasPathInjection=102
128
- fm. trashItem ( at: remoteUrl, resultingItemURL: AutoreleasingUnsafeMutablePointer< NSURL?> . init ( bitPattern : 0 ) ) // $ hasPathInjection=102
129
- let _ = fm. replaceItemAt ( remoteUrl, withItemAt: safeUrl, backupItemName: nil , options: [ ] ) // $ hasPathInjection=102
130
- let _ = fm. replaceItemAt ( safeUrl, withItemAt: remoteUrl, backupItemName: nil , options: [ ] ) // $ hasPathInjection=102
131
- fm. replaceItem ( at: remoteUrl, withItemAt: safeUrl, backupItemName: nil , options: [ ] , resultingItemURL: AutoreleasingUnsafeMutablePointer< NSURL?> . init ( bitPattern : 0 ) ) // $ hasPathInjection=102
132
- fm. replaceItem ( at: safeUrl, withItemAt: remoteUrl, backupItemName: nil , options: [ ] , resultingItemURL: AutoreleasingUnsafeMutablePointer< NSURL?> . init ( bitPattern : 0 ) ) // $ hasPathInjection=102
133
- fm. copyItem ( at: remoteUrl, to: safeUrl) // $ hasPathInjection=102
134
- fm. copyItem ( at: safeUrl, to: remoteUrl) // $ hasPathInjection=102
135
- fm. copyItem ( atPath: remoteString, toPath: " " ) // $ hasPathInjection=102
136
- fm. copyItem ( atPath: " " , toPath: remoteString) // $ hasPathInjection=102
137
- fm. moveItem ( at: remoteUrl, to: safeUrl) // $ hasPathInjection=102
138
- fm. moveItem ( at: safeUrl, to: remoteUrl) // $ hasPathInjection=102
139
- fm. moveItem ( atPath: remoteString, toPath: " " ) // $ hasPathInjection=102
140
- fm. moveItem ( atPath: " " , toPath: remoteString) // $ hasPathInjection=102
141
- fm. createSymbolicLink ( at: remoteUrl, withDestinationURL: safeUrl) // $ hasPathInjection=102
142
- fm. createSymbolicLink ( at: safeUrl, withDestinationURL: remoteUrl) // $ hasPathInjection=102
143
- fm. createSymbolicLink ( atPath: remoteString, withDestinationPath: " " ) // $ hasPathInjection=102
144
- fm. createSymbolicLink ( atPath: " " , withDestinationPath: remoteString) // $ hasPathInjection=102
145
- fm. linkItem ( at: remoteUrl, to: safeUrl) // $ hasPathInjection=102
146
- fm. linkItem ( at: safeUrl, to: remoteUrl) // $ hasPathInjection=102
147
- fm. linkItem ( atPath: remoteString, toPath: " " ) // $ hasPathInjection=102
148
- fm. linkItem ( atPath: " " , toPath: remoteString) // $ hasPathInjection=102
149
- let _ = fm. destinationOfSymbolicLink ( atPath: remoteString) // $ hasPathInjection=102
150
- let _ = fm. fileExists ( atPath: remoteString) // $ hasPathInjection=102
151
- let _ = fm. fileExists ( atPath: remoteString, isDirectory: UnsafeMutablePointer< ObjCBool> . init( bitPattern: 0 ) ) // $ hasPathInjection=102
152
- let _ = fm. isReadableFile ( atPath: remoteString) // $ hasPathInjection=102
153
- let _ = fm. isWritableFile ( atPath: remoteString) // $ hasPathInjection=102
154
- let _ = fm. isDeletableFile ( atPath: remoteString) // $ hasPathInjection=102
155
- let _ = fm. componentsToDisplay ( forPath: remoteString) // $ hasPathInjection=102
156
- let _ = fm. displayName ( atPath: remoteString) // $ hasPathInjection=102
157
- let _ = fm. attributesOfItem ( atPath: remoteString) // $ hasPathInjection=102
158
- let _ = fm. attributesOfFileSystem ( forPath: remoteString) // $ hasPathInjection=102
159
- fm. setAttributes ( [ : ] , ofItemAtPath: remoteString) // $ hasPathInjection=102
160
- let _ = fm. contents ( atPath: remoteString) // $ hasPathInjection=102
161
- let _ = fm. contentsEqual ( atPath: remoteString, andPath: " " ) // $ hasPathInjection=102
162
- let _ = fm. contentsEqual ( atPath: " " , andPath: remoteString) // $ hasPathInjection=102
163
- fm. getRelationship ( UnsafeMutablePointer< FileManager . URLRelationship> . allocate( capacity: 0 ) , ofDirectoryAt: remoteUrl, toItemAt: safeUrl) // $ hasPathInjection=102
164
- fm. getRelationship ( UnsafeMutablePointer< FileManager . URLRelationship> . allocate( capacity: 0 ) , ofDirectoryAt: safeUrl, toItemAt: remoteUrl) // $ hasPathInjection=102
165
- fm. getRelationship ( UnsafeMutablePointer< FileManager . URLRelationship> . allocate( capacity: 0 ) , of: FileManager . SearchPathDirectory. none, in: FileManager . SearchPathDomainMask ( ) , toItemAt: remoteUrl) // $ hasPathInjection=102
166
- let _ = fm. changeCurrentDirectoryPath ( remoteString) // $ hasPathInjection=102
167
- let _ = fm. unmountVolume ( at: remoteUrl, options: [ ] , completionHandler: { _ in } ) // $ hasPathInjection=102
168
- let _ = fm. NSHFSTypeOfFile ( remoteString) // $ hasPathInjection=102
119
+ let _ = fm. contentsOfDirectory ( at: remoteUrl, includingPropertiesForKeys: [ ] , options: [ ] ) // $ hasPathInjection=104
120
+ let _ = fm. contentsOfDirectory ( atPath: remoteString) // $ hasPathInjection=104
121
+ let _ = fm. enumerator ( at: remoteUrl, includingPropertiesForKeys: [ ] , options: [ ] , errorHandler: nil ) // $ hasPathInjection=104
122
+ let _ = fm. enumerator ( atPath: remoteString) // $ hasPathInjection=104
123
+ let _ = fm. subpathsOfDirectory ( atPath: remoteString) // $ hasPathInjection=104
124
+ let _ = fm. subpaths ( atPath: remoteString) // $ hasPathInjection=104
125
+ fm. createDirectory ( at: remoteUrl, withIntermediateDirectories: false , attributes: [ : ] ) // $ hasPathInjection=104
126
+ let _ = fm. createDirectory ( atPath: remoteString, attributes: [ : ] ) // $ hasPathInjection=104
127
+ let _ = fm. createFile ( atPath: remoteString, contents: nil , attributes: [ : ] ) // $ hasPathInjection=104
128
+ fm. removeItem ( at: remoteUrl) // $ hasPathInjection=104
129
+ fm. removeItem ( atPath: remoteString) // $ hasPathInjection=104
130
+ fm. trashItem ( at: remoteUrl, resultingItemURL: AutoreleasingUnsafeMutablePointer < NSURL ? > ( ) ) // $ hasPathInjection=104
131
+ let _ = fm. replaceItemAt ( remoteUrl, withItemAt: safeUrl, backupItemName: nil , options: [ ] ) // $ hasPathInjection=104
132
+ let _ = fm. replaceItemAt ( safeUrl, withItemAt: remoteUrl, backupItemName: nil , options: [ ] ) // $ hasPathInjection=104
133
+ fm. replaceItem ( at: remoteUrl, withItemAt: safeUrl, backupItemName: nil , options: [ ] , resultingItemURL: AutoreleasingUnsafeMutablePointer < NSURL ? > ( ) ) // $ hasPathInjection=104
134
+ fm. replaceItem ( at: safeUrl, withItemAt: remoteUrl, backupItemName: nil , options: [ ] , resultingItemURL: AutoreleasingUnsafeMutablePointer < NSURL ? > ( ) ) // $ hasPathInjection=104
135
+ fm. copyItem ( at: remoteUrl, to: safeUrl) // $ hasPathInjection=104
136
+ fm. copyItem ( at: safeUrl, to: remoteUrl) // $ hasPathInjection=104
137
+ fm. copyItem ( atPath: remoteString, toPath: " " ) // $ hasPathInjection=104
138
+ fm. copyItem ( atPath: " " , toPath: remoteString) // $ hasPathInjection=104
139
+ fm. moveItem ( at: remoteUrl, to: safeUrl) // $ hasPathInjection=104
140
+ fm. moveItem ( at: safeUrl, to: remoteUrl) // $ hasPathInjection=104
141
+ fm. moveItem ( atPath: remoteString, toPath: " " ) // $ hasPathInjection=104
142
+ fm. moveItem ( atPath: " " , toPath: remoteString) // $ hasPathInjection=104
143
+ fm. createSymbolicLink ( at: remoteUrl, withDestinationURL: safeUrl) // $ hasPathInjection=104
144
+ fm. createSymbolicLink ( at: safeUrl, withDestinationURL: remoteUrl) // $ hasPathInjection=104
145
+ fm. createSymbolicLink ( atPath: remoteString, withDestinationPath: " " ) // $ hasPathInjection=104
146
+ fm. createSymbolicLink ( atPath: " " , withDestinationPath: remoteString) // $ hasPathInjection=104
147
+ fm. linkItem ( at: remoteUrl, to: safeUrl) // $ hasPathInjection=104
148
+ fm. linkItem ( at: safeUrl, to: remoteUrl) // $ hasPathInjection=104
149
+ fm. linkItem ( atPath: remoteString, toPath: " " ) // $ hasPathInjection=104
150
+ fm. linkItem ( atPath: " " , toPath: remoteString) // $ hasPathInjection=104
151
+ let _ = fm. destinationOfSymbolicLink ( atPath: remoteString) // $ hasPathInjection=104
152
+ let _ = fm. fileExists ( atPath: remoteString) // $ hasPathInjection=104
153
+ let _ = fm. fileExists ( atPath: remoteString, isDirectory: UnsafeMutablePointer< ObjCBool> . init( bitPattern: 0 ) ) // $ hasPathInjection=104
154
+ let _ = fm. isReadableFile ( atPath: remoteString) // $ hasPathInjection=104
155
+ let _ = fm. isWritableFile ( atPath: remoteString) // $ hasPathInjection=104
156
+ let _ = fm. isDeletableFile ( atPath: remoteString) // $ hasPathInjection=104
157
+ let _ = fm. componentsToDisplay ( forPath: remoteString) // $ hasPathInjection=104
158
+ let _ = fm. displayName ( atPath: remoteString) // $ hasPathInjection=104
159
+ let _ = fm. attributesOfItem ( atPath: remoteString) // $ hasPathInjection=104
160
+ let _ = fm. attributesOfFileSystem ( forPath: remoteString) // $ hasPathInjection=104
161
+ fm. setAttributes ( [ : ] , ofItemAtPath: remoteString) // $ hasPathInjection=104
162
+ let _ = fm. contents ( atPath: remoteString) // $ hasPathInjection=104
163
+ let _ = fm. contentsEqual ( atPath: remoteString, andPath: " " ) // $ hasPathInjection=104
164
+ let _ = fm. contentsEqual ( atPath: " " , andPath: remoteString) // $ hasPathInjection=104
165
+ fm. getRelationship ( UnsafeMutablePointer< FileManager . URLRelationship> . allocate( capacity: 0 ) , ofDirectoryAt: remoteUrl, toItemAt: safeUrl) // $ hasPathInjection=104
166
+ fm. getRelationship ( UnsafeMutablePointer< FileManager . URLRelationship> . allocate( capacity: 0 ) , ofDirectoryAt: safeUrl, toItemAt: remoteUrl) // $ hasPathInjection=104
167
+ fm. getRelationship ( UnsafeMutablePointer< FileManager . URLRelationship> . allocate( capacity: 0 ) , of: FileManager . SearchPathDirectory. none, in: FileManager . SearchPathDomainMask ( ) , toItemAt: remoteUrl) // $ hasPathInjection=104
168
+ let _ = fm. changeCurrentDirectoryPath ( remoteString) // $ hasPathInjection=104
169
+ let _ = fm. unmountVolume ( at: remoteUrl, options: [ ] , completionHandler: { _ in } ) // $ hasPathInjection=104
170
+ let _ = fm. NSHFSTypeOfFile ( remoteString) // $ hasPathInjection=104
169
171
// Deprecated methods
170
- let _ = fm. changeFileAttributes ( [ : ] , atPath: remoteString) // $ hasPathInjection=102
171
- let _ = fm. fileAttributes ( atPath: remoteString, traverseLink: false ) // $ hasPathInjection=102
172
- let _ = fm. fileSystemAttributes ( atPath: remoteString) // $ hasPathInjection=102
173
- let _ = fm. directoryContents ( atPath: remoteString) // $ hasPathInjection=102
174
- let _ = fm. createDirectory ( atPath: remoteString, attributes: [ : ] ) // $ hasPathInjection=102
175
- let _ = fm. createSymbolicLink ( atPath: remoteString, pathContent: " " ) // $ hasPathInjection=102
176
- let _ = fm. createSymbolicLink ( atPath: " " , pathContent: remoteString) // $ hasPathInjection=102
177
- let _ = fm. pathContentOfSymbolicLink ( atPath: remoteString) // $ hasPathInjection=102
178
- let _ = fm. replaceItemAtURL ( originalItemURL: remoteNsUrl, withItemAtURL: safeNsUrl, backupItemName: nil , options: [ ] ) // $ hasPathInjection=102
179
- let _ = fm. replaceItemAtURL ( originalItemURL: safeNsUrl, withItemAtURL: remoteNsUrl, backupItemName: nil , options: [ ] ) // $ hasPathInjection=102
172
+ let _ = fm. changeFileAttributes ( [ : ] , atPath: remoteString) // $ hasPathInjection=104
173
+ let _ = fm. fileAttributes ( atPath: remoteString, traverseLink: false ) // $ hasPathInjection=104
174
+ let _ = fm. fileSystemAttributes ( atPath: remoteString) // $ hasPathInjection=104
175
+ let _ = fm. directoryContents ( atPath: remoteString) // $ hasPathInjection=104
176
+ let _ = fm. createDirectory ( atPath: remoteString, attributes: [ : ] ) // $ hasPathInjection=104
177
+ let _ = fm. createSymbolicLink ( atPath: remoteString, pathContent: " " ) // $ hasPathInjection=104
178
+ let _ = fm. createSymbolicLink ( atPath: " " , pathContent: remoteString) // $ hasPathInjection=104
179
+ let _ = fm. pathContentOfSymbolicLink ( atPath: remoteString) // $ hasPathInjection=104
180
+ let _ = fm. replaceItemAtURL ( originalItemURL: remoteNsUrl, withItemAtURL: safeNsUrl, backupItemName: nil , options: [ ] ) // $ hasPathInjection=104
181
+ let _ = fm. replaceItemAtURL ( originalItemURL: safeNsUrl, withItemAtURL: remoteNsUrl, backupItemName: nil , options: [ ] ) // $ hasPathInjection=104
180
182
}
0 commit comments