Skip to content

Commit fd23fa9

Browse files
committed
Python: Remove dubious fstat* modeling
These operate on file descriptors, and not on paths. file descriptors doesn't fit into the rest of our modeling, so I would rather remove them than to make it look like it's properly handled. I also did not include any of the functions that work on file descriptors when looking through all of `os`. So this keeps everything consistent at least ;)
1 parent e79b8f3 commit fd23fa9

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

python/ql/lib/semmle/python/frameworks/Stdlib.qll

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,13 @@ private module StdlibPrivate {
279279
* The `os` module has multiple methods for getting the status of a file, like
280280
* a stat() system call.
281281
*
282-
* Note: `os.fstat` and `os.fstatvfs` operate on file-descriptors.
283-
*
284282
* See:
285283
* - https://docs.python.org/3.10/library/os.html#os.stat
286284
* - https://docs.python.org/3.10/library/os.html#os.lstat
287285
* - https://docs.python.org/3.10/library/os.html#os.statvfs
288-
* - https://docs.python.org/3.10/library/os.html#os.fstat
289-
* - https://docs.python.org/3.10/library/os.html#os.fstatvfs
290286
*/
291287
private class OsProbingCall extends FileSystemAccess::Range, DataFlow::CallCfgNode {
292-
OsProbingCall() {
293-
this = os().getMember(["stat", "lstat", "statvfs", "fstat", "fstatvfs"]).getACall()
294-
}
288+
OsProbingCall() { this = os().getMember(["stat", "lstat", "statvfs"]).getACall() }
295289

296290
override DataFlow::Node getAPathArgument() {
297291
result in [this.getArg(0), this.getArgByName("path")]

0 commit comments

Comments
 (0)