fix(dtls): remove duplicate DEL_PEER in handle_alert()#271
Closed
re2zero wants to merge 1 commit into
Closed
Conversation
handle_alert() calls DEL_PEER() to remove the peer from the hash table, then calls dtls_destroy_peer() which calls DEL_PEER() again. This double removal corrupts the uthash hash table and can lead to crashes or undefined behavior. Remove the DEL_PEER() call from handle_alert() since dtls_destroy_peer() already handles peer cleanup including removal from the hash table. Fixes eclipse-tinydtls#269
Author
|
Closing this PR as I am unable to complete the Eclipse Contributor Agreement (ECA) requirement. The fix itself is straightforward: remove the duplicate DEL_PEER() call in handle_alert() to prevent uthash corruption. Feel free to take the patch. |
Contributor
|
PR #270 is already addressing that issue. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DEL_PEER()call inhandle_alert()to fix uthash corruptionProblem
handle_alert()callsDEL_PEER()to remove the peer from the hash table, then callsdtls_destroy_peer()which callsDEL_PEER()again on the same peer. SinceHASH_DELETE_HHin uthash does not check if the entry is in the table, this double removal corrupts the hash table bucket chains andnum_itemscounter, potentially leading to crashes or use-after-free.Fix
Remove the
DEL_PEER()call fromhandle_alert()sincedtls_destroy_peer()already handles the complete peer cleanup including removal from the hash table.Changes
dtls.cDEL_PEER()inhandle_alert(), update commentFixes #269