This is an automated email from the ASF dual-hosted git repository.

gmurthy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git


The following commit(s) were added to refs/heads/main by this push:
     new 25f720c  DISPATCH-2045: If the handle being freed points to an item, 
make sure to zero out the item's handle so it cannot be dereferenced later. 
This closes #1119.
25f720c is described below

commit 25f720cf2d0fb3fff30c88e42dd5f8677868f35d
Author: Ganesh Murthy <gmur...@apache.org>
AuthorDate: Wed Apr 14 09:50:18 2021 -0400

    DISPATCH-2045: If the handle being freed points to an item, make sure to 
zero out the item's handle so it cannot be dereferenced later. This closes 
#1119.
---
 src/hash.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/hash.c b/src/hash.c
index 08a01e8..f396e98 100644
--- a/src/hash.c
+++ b/src/hash.c
@@ -445,8 +445,16 @@ qd_error_t qd_hash_remove_str(qd_hash_t *h, const unsigned 
char *key)
 
 void qd_hash_handle_free(qd_hash_handle_t *handle)
 {
-    if (handle)
+    if (handle) {
+        //
+        // The hash handle is being freed. if the handle points to an item, 
make sure to zero out the
+        // item's handle so it cannot be dereferenced later.
+        //
+        if (handle->item && handle->item->handle) {
+            handle->item->handle = 0;
+        }
         free_qd_hash_handle_t(handle);
+    }
 }
 
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to