-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
fix(Core/OutdoorPvP): Fix use-after-free in DelCapturePoint #25229
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: master
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 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -215,15 +215,15 @@ bool OPvPCapturePoint::DelObject(uint32 type) | |||||||||||||||
|
|
||||||||||||||||
| bool OPvPCapturePoint::DelCapturePoint() | ||||||||||||||||
| { | ||||||||||||||||
| sObjectMgr->DeleteGOData(m_capturePointSpawnId); | ||||||||||||||||
| m_capturePointSpawnId = 0; | ||||||||||||||||
|
|
||||||||||||||||
| if (_capturePoint) | ||||||||||||||||
| { | ||||||||||||||||
| _capturePoint->SetRespawnTime(0); // not save respawn time | ||||||||||||||||
| _capturePoint->Delete(); | ||||||||||||||||
| } | ||||||||||||||||
|
|
||||||||||||||||
| sObjectMgr->DeleteGOData(m_capturePointSpawnId); | ||||||||||||||||
| m_capturePointSpawnId = 0; | ||||||||||||||||
|
Comment on lines
+224
to
+225
|
||||||||||||||||
| sObjectMgr->DeleteGOData(m_capturePointSpawnId); | |
| m_capturePointSpawnId = 0; | |
| if (m_capturePointSpawnId) | |
| { | |
| sObjectMgr->DeleteGOData(m_capturePointSpawnId); | |
| m_capturePointSpawnId = 0; | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_capturePointremains non-null after calling_capturePoint->Delete(). IfDelete()frees the object (or makes the pointer invalid), leaving the member pointer set can enable later use-after-free via any subsequent_capturePointchecks. Consider clearing the member immediately after deletion (e.g., set_capturePoint = nullptr;afterDelete()) to make the object lifecycle explicit and prevent accidental reuse.