Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dd28157

Browse files
committed
add test of a length check
1 parent 8e47a9b commit dd28157

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

javascript/ql/test/query-tests/Security/CWE-770/ResourceExhaustion/resource-exhaustion.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,11 @@ var server = http.createServer(function(req, res) {
8484
setInterval(f, s); // NOT OK
8585

8686
Buffer.alloc(n.length); // OK - only allocing as much as the length of the input.
87+
88+
Buffer.alloc(n); // NOT OK
89+
if (n < 1000) {
90+
Buffer.alloc(n); // OK - length check
91+
} else {
92+
Buffer.alloc(n); // NOT OK - NO length check
93+
}
8794
});

0 commit comments

Comments
 (0)