Small improvement to go/unhandled-writable-file-close

This commit is contained in:
Owen Mansel-Chan
2025-10-02 15:15:51 +01:00
parent 7fdda87b06
commit d8891e34d1

View File

@@ -70,8 +70,8 @@ predicate unhandledCall(DataFlow::CallNode call) {
*/
predicate isWritableFileHandle(DataFlow::Node source, DataFlow::CallNode call) {
exists(OpenFileFun f, DataFlow::Node flags, QualifiedName flag |
// check that the source is a result of the call
source = call.getAResult() and
// check that the source is the first result of the call
source = call.getResult(0) and
// find a call to the os.OpenFile function
f.getACall() = call and
// get the flags expression used for opening the file