diff --git a/cwe.js b/cwe.js index bb09a12..301798b 100644 --- a/cwe.js +++ b/cwe.js @@ -1,4 +1,10 @@ // This will show examples related with the Common Weakness Enumeration (CWE). +function CWE_129(x) { // ARRAY_INDEX_NEGATIVE + var arr = [1, 2, 3]; + if (x < 0) { + arr[x] = 3; + } +} function CWE_398() { // IDENTICAL_BRANCHES if (x >= 0) { @@ -50,18 +56,3 @@ foo = url.replace(/\s/gi, ""); console.log(foo); } - - function CWE_628() { // TOO_MANY_ARGS - function add(x, y) { - return x + y; - } - var sum = add(1, 2, 3); - console.log(sum); - } - - function CWE_670(x) { // STRAY_SEMICOLON - while (++x <= 10) ; - { - sum += x; - } - }