Skip to content

Commit

Permalink
[fix] long whitespace is evil, don't allow it
Browse files Browse the repository at this point in the history
There are broken sequences like "([^smth])*\s+" or "[^smth]+ *".
This prevents abusing those.
  • Loading branch information
ChALkeR committed Apr 3, 2019
1 parent c92567b commit 687afe4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -417,8 +417,8 @@ function isSafe(userAgent) {

for (var i = 0; i < userAgent.length; i++) {
code = userAgent.charCodeAt(i);
// numbers between 0 and 9, letters between a and z
if ((code >= 48 && code <= 57) || (code >= 97 && code <= 122)) {
// numbers between 0 and 9, letters between a and z, spaces and control
if ((code >= 48 && code <= 57) || (code >= 97 && code <= 122) || code <= 32) {
consecutive++;
} else {
consecutive = 0;
Expand Down

0 comments on commit 687afe4

Please sign in to comment.