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 ;)
This commit is contained in:
Rasmus Wriedt Larsen
2021-11-29 13:58:39 +01:00
parent e79b8f3e23
commit fd23fa94a5

View File

@@ -279,19 +279,13 @@ private module StdlibPrivate {
* The `os` module has multiple methods for getting the status of a file, like
* a stat() system call.
*
* Note: `os.fstat` and `os.fstatvfs` operate on file-descriptors.
*
* See:
* - https://docs.python.org/3.10/library/os.html#os.stat
* - https://docs.python.org/3.10/library/os.html#os.lstat
* - https://docs.python.org/3.10/library/os.html#os.statvfs
* - https://docs.python.org/3.10/library/os.html#os.fstat
* - https://docs.python.org/3.10/library/os.html#os.fstatvfs
*/
private class OsProbingCall extends FileSystemAccess::Range, DataFlow::CallCfgNode {
OsProbingCall() {
this = os().getMember(["stat", "lstat", "statvfs", "fstat", "fstatvfs"]).getACall()
}
OsProbingCall() { this = os().getMember(["stat", "lstat", "statvfs"]).getACall() }
override DataFlow::Node getAPathArgument() {
result in [this.getArg(0), this.getArgByName("path")]