Skip to content

Commit

Permalink
Validate gameserver IP/Hostname before connecting
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyut0n committed Jan 3, 2020
1 parent 6513ae4 commit 07aceda
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion includes/gameserver.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ public function passthru_db_query($query, $multi = TRUE) {
public function set_gameserver( $ip, $port ) {
$this->ip = $ip;
$this->port = $port;
$this->ispublic = TRUE;
// Verify valid IP or resolvable hostname
$this->ispublic = ( filter_var($ip, FILTER_VALIDATE_IP) || gethostbyname($ip) !== $ip );
}

# Connect to gameserver through SourceQuery library
Expand Down

0 comments on commit 07aceda

Please sign in to comment.