mirror of
https://github.com/github/codeql.git
synced 2026-04-25 08:45:14 +02:00
JS: Show problem with new RegExp().exec()
This commit is contained in:
@@ -6,7 +6,7 @@ window.location = /.*redirect=([^&]*).*/.exec(document.location.href)[1];
|
||||
window.location = indirect.exec(document.location.href)[1];
|
||||
});
|
||||
|
||||
// NOT OK
|
||||
// NOT OK [INCONSISTENCY]
|
||||
window.location = new RegExp('.*redirect=([^&]*).*').exec(document.location.href)[1];
|
||||
|
||||
(function(){
|
||||
@@ -14,7 +14,7 @@ window.location = new RegExp('.*redirect=([^&]*).*').exec(document.location.href
|
||||
window.location = indirect.exec(document.location.href)[1];
|
||||
});
|
||||
|
||||
// NOT OK
|
||||
// NOT OK [INCONSISTENCY]
|
||||
window.location = new RegExp(/.*redirect=([^&]*).*/).exec(document.location.href)[1];
|
||||
|
||||
(function(){
|
||||
@@ -23,7 +23,7 @@ window.location = new RegExp(/.*redirect=([^&]*).*/).exec(document.location.href
|
||||
});
|
||||
|
||||
function foo(win) {
|
||||
win.location.assign(new RegExp(/.*redirect=([^&]*).*/).exec(win.location.href)[1]); // NOT OK
|
||||
win.location.assign(new RegExp(/.*redirect=([^&]*).*/).exec(win.location.href)[1]); // NOT OK [INCONSISTENCY]
|
||||
}
|
||||
|
||||
foo(window);
|
||||
foo(window);
|
||||
|
||||
Reference in New Issue
Block a user