add test of a length check

This commit is contained in:
Erik Krogh Kristensen
2022-04-13 09:41:06 +02:00
parent 8e47a9b242
commit dd28157d0a

View File

@@ -84,4 +84,11 @@ var server = http.createServer(function(req, res) {
setInterval(f, s); // NOT OK
Buffer.alloc(n.length); // OK - only allocing as much as the length of the input.
Buffer.alloc(n); // NOT OK
if (n < 1000) {
Buffer.alloc(n); // OK - length check
} else {
Buffer.alloc(n); // NOT OK - NO length check
}
});