Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit187c172

Browse files
authored
Merge pull request#137 from ChALkeR/320159-part-1
320159 fixes part 1
2 parentsc92567b +79c7c54 commit187c172

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

‎index.js‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,12 @@ function isSafe(userAgent) {
415415
varconsecutive=0
416416
,code=0;
417417

418+
if(userAgent.length>1000)returnfalse;
419+
418420
for(vari=0;i<userAgent.length;i++){
419421
code=userAgent.charCodeAt(i);
420-
// numbers between 0 and 9, letters between a and z
421-
if((code>=48&&code<=57)||(code>=97&&code<=122)){
422+
// numbers between 0 and 9, letters between a and z, spaces and control
423+
if((code>=48&&code<=57)||(code>=97&&code<=122)||code<=32){
422424
consecutive++;
423425
}else{
424426
consecutive=0;
@@ -443,6 +445,10 @@ function isSafe(userAgent) {
443445
*@api public
444446
*/
445447
exports.parse=functionparse(userAgent,jsAgent){
448+
if(userAgent&&userAgent.length>1000){
449+
userAgent=userAgent.substring(0,1000);
450+
}
451+
446452
if(!userAgent||!isSafe(userAgent))returnnewAgent();
447453

448454
varlength=agentparserslength

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp