Skip to content

Commit

Permalink
Merge pull request #10 from CrystSw/develop
Browse files Browse the repository at this point in the history
類似度計算の不備+αを修正
  • Loading branch information
CrystSw authored Jun 4, 2020
2 parents 86b3ed1 + 6fb3221 commit 5898430
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/corefiles/OlinvasCore.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ public function onMessage(ConnectionInterface $from, $message){

//ログ出力
$GLOBALS['logger']->printLog(LOG_WARNING, "JoinRoom-Reject: Request from '{$from->remoteAddress}'.");

//無効パケット検出処理(意図せず起こり得るので配慮)
$this->detectIllegalPacket($from, 5);
break;
}
if(
Expand All @@ -392,7 +395,7 @@ public function onMessage(ConnectionInterface $from, $message){
$GLOBALS['logger']->printLog(LOG_WARNING, "JoinRoom-Reject: Request from '{$from->remoteAddress}'.");

//無効パケット検出処理(意図せず起こり得るので配慮)
$this->detectIllegalPacket($from, (1.0-levenshtein($this->roomInfo[$roomId]->getPassword(), $roomPassword)/max(strlen($this->roomInfo[$roomId]->getPassword()), strlen($roomPassword)))*20);
$this->detectIllegalPacket($from, (levenshtein($this->roomInfo[$roomId]->getPassword(), $roomPassword)/max(strlen($this->roomInfo[$roomId]->getPassword()), strlen($roomPassword)))*20);
break;
}
//==================================
Expand Down Expand Up @@ -503,7 +506,7 @@ public function onMessage(ConnectionInterface $from, $message){
$GLOBALS['logger']->printLog(LOG_WARNING, "FriendAuth-Reject: Request from '{$from->remoteAddress}'.");

//無効パケット検出処理(意図せず起こり得るので配慮)
$this->detectIllegalPacket($from, (1.0-levenshtein($this->roomInfo[$roomId]->getFriendKey(), $roomFriendKey)/max(strlen($this->roomInfo[$roomId]->getFriendKey()), strlen($roomFriendKey)))*12);
$this->detectIllegalPacket($from, (levenshtein($this->roomInfo[$roomId]->getFriendKey(), $roomFriendKey)/max(strlen($this->roomInfo[$roomId]->getFriendKey()), strlen($roomFriendKey)))*12);
break;
}
//==================================
Expand Down

0 comments on commit 5898430

Please sign in to comment.