-
Notifications
You must be signed in to change notification settings - Fork 167
fix(logic): Improve validation of MSG_DO_SPECIAL_POWER and variants in GameLogicDispatch #2380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -680,6 +680,16 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) | |
| Object* source = findObjectByID(sourceID); | ||
| if (source != nullptr) | ||
| { | ||
| // TheSuperHackers @fix stephanmeesters 01/03/2026 Validate the origin of the source object | ||
| if ( source->getControllingPlayer() != thisPlayer ) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One more thought on this: This would cause mismatch if someone cheated, for example with Control Hack. Are we ok with this? It probably needs to go behind RETAIL_COMPATIBLE_CRC for the upmost correctness
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO mismatch is desirable here, and would be nice if the first release can have all these cases solid so it's a more "trustworthy" client (although, it doesn't actually communicate around that it did a good thing..) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we decide to go that route, then at least put a commented |
||
| { | ||
| DEBUG_CRASH( ("MSG_DO_SPECIAL_POWER: Player '%ls' attempted to control the object '%s' owned by player '%ls'.", | ||
| thisPlayer->getPlayerDisplayName().str(), | ||
| source->getTemplate()->getName().str(), | ||
| source->getControllingPlayer()->getPlayerDisplayName().str()) ); | ||
| break; | ||
| } | ||
|
|
||
| AIGroupPtr theGroup = TheAI->createGroup(); | ||
| theGroup->add(source); | ||
| theGroup->groupDoSpecialPower( specialPowerID, options ); | ||
|
|
@@ -725,6 +735,16 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) | |
| Object* source = findObjectByID(sourceID); | ||
| if (source != nullptr) | ||
| { | ||
| // TheSuperHackers @fix stephanmeesters 01/03/2026 Validate the origin of the source object | ||
| if ( source->getControllingPlayer() != thisPlayer ) | ||
| { | ||
| DEBUG_CRASH( ("MSG_DO_SPECIAL_POWER_AT_LOCATION: Player '%ls' attempted to control the object '%s' owned by player '%ls'.", | ||
| thisPlayer->getPlayerDisplayName().str(), | ||
| source->getTemplate()->getName().str(), | ||
| source->getControllingPlayer()->getPlayerDisplayName().str()) ); | ||
| break; | ||
| } | ||
|
|
||
stephanmeesters marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| AIGroupPtr theGroup = TheAI->createGroup(); | ||
| theGroup->add(source); | ||
| theGroup->groupDoSpecialPowerAtLocation( specialPowerID, &targetCoord, angle, objectInWay, options ); | ||
|
|
@@ -768,6 +788,16 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) | |
| Object* source = findObjectByID(sourceID); | ||
| if (source != nullptr) | ||
| { | ||
| // TheSuperHackers @fix stephanmeesters 01/03/2026 Validate the origin of the source object | ||
| if ( source->getControllingPlayer() != thisPlayer ) | ||
| { | ||
| DEBUG_CRASH( ("MSG_DO_SPECIAL_POWER_AT_OBJECT: Player '%ls' attempted to control the object '%s' owned by player '%ls'.", | ||
| thisPlayer->getPlayerDisplayName().str(), | ||
| source->getTemplate()->getName().str(), | ||
| source->getControllingPlayer()->getPlayerDisplayName().str()) ); | ||
| break; | ||
| } | ||
|
|
||
| AIGroupPtr theGroup = TheAI->createGroup(); | ||
| theGroup->add(source); | ||
| theGroup->groupDoSpecialPowerAtObject( specialPowerID, target, options ); | ||
|
|
@@ -1211,6 +1241,16 @@ void GameLogic::logicMessageDispatcher( GameMessage *msg, void *userData ) | |
| Object* source = findObjectByID(sourceID); | ||
| if (source != nullptr) | ||
| { | ||
| // TheSuperHackers @fix stephanmeesters 01/03/2026 Validate the origin of the source object | ||
| if ( source->getControllingPlayer() != thisPlayer ) | ||
| { | ||
| DEBUG_CRASH( ("MSG_DO_SPECIAL_POWER_OVERRIDE_DESTINATION: Player '%ls' attempted to control the object '%s' owned by player '%ls'.", | ||
| thisPlayer->getPlayerDisplayName().str(), | ||
| source->getTemplate()->getName().str(), | ||
| source->getControllingPlayer()->getPlayerDisplayName().str()) ); | ||
| break; | ||
| } | ||
|
|
||
| AIGroupPtr theGroup = TheAI->createGroup(); | ||
| theGroup->add(source); | ||
| theGroup->groupOverrideSpecialPowerDestination( spType, loc, CMD_FROM_PLAYER ); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.