mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
require the file to be non-empty
This commit is contained in:
@@ -69,6 +69,8 @@ class UselessCat extends DataFlow::CallNode {
|
||||
this = candidate and
|
||||
// We can create an equivalent `fs.readFile` call.
|
||||
exists(createReadFileCall(this)) and
|
||||
// There is a file to read, and not just a pair of quotes.
|
||||
candidate.getFileArgument().length() >= 3 and
|
||||
// wildcards, pipes, redirections, and multiple files are OK.
|
||||
// (The multiple files detection relies on the fileArgument not containing spaces anywhere)
|
||||
not candidate.getFileArgument().regexpMatch(".*(\\*|\\||>|<| ).*") and
|
||||
|
||||
Reference in New Issue
Block a user