Fix parallel building exploit via race condition (#141)

Co-authored-by: hdmaniak <bombo15.forum@gmail.com>
This commit is contained in:
hdmaniak2
2026-03-24 07:48:54 +01:00
committed by GitHub
parent a7bdac8392
commit e83985e7f7
2 changed files with 136 additions and 99 deletions
+12
View File
@@ -4556,6 +4556,18 @@ References: User ID/Message ID, Mode
return mysqli_query($this->dblink,$q);
}
function getBuildLock($wid) {
$wid = (int) $wid;
$result = mysqli_query($this->dblink, "SELECT GET_LOCK('build_village_$wid', 10) AS locked");
$row = mysqli_fetch_assoc($result);
return $row['locked'] == 1;
}
function releaseBuildLock($wid) {
$wid = (int) $wid;
mysqli_query($this->dblink, "SELECT RELEASE_LOCK('build_village_$wid')");
}
/**
* Get the time required to build a specified building
*