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

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


The following commit(s) were added to refs/heads/master by this push:
     new 1547a2f  DISPATCH-1387 - Additional fix. Fix null pointer dereference 
problems. This closes #563.
1547a2f is described below

commit 1547a2fe47a83f2e83d6ee9b8ec92ea2dec2c1c8
Author: Ganesh Murthy <gmur...@apache.org>
AuthorDate: Mon Sep 9 15:38:02 2019 -0400

    DISPATCH-1387 - Additional fix. Fix null pointer dereference problems. This 
closes #563.
---
 src/router_core/agent_address.c           | 24 +++++++++++++++---------
 src/router_core/agent_config_address.c    | 26 +++++++++++++++++---------
 src/router_core/agent_config_link_route.c | 11 ++++++++---
 3 files changed, 40 insertions(+), 21 deletions(-)

diff --git a/src/router_core/agent_address.c b/src/router_core/agent_address.c
index 1662f0b..22d5cc1 100644
--- a/src/router_core/agent_address.c
+++ b/src/router_core/agent_address.c
@@ -289,16 +289,22 @@ void qdra_address_get_first_CT(qdr_core_t *core, 
qdr_query_t *query, int offset)
         addr = DEQ_NEXT(addr);
     assert(addr != 0);
 
-    //
-    // Write the columns of the address entity into the response body.
-    //
-    qdr_manage_write_address_list_CT(core, query, addr);
+    if (addr) {
+        //
+        // Write the columns of the address entity into the response body.
+        //
+        qdr_manage_write_address_list_CT(core, query, addr);
+
+        //
+        // Advance to the next address
+        //
+        query->next_offset = offset;
+        qdr_manage_advance_address_CT(query, addr);
+    }
+    else {
+        query->more = false;
+    }
 
-    //
-    // Advance to the next address
-    //
-    query->next_offset = offset;
-    qdr_manage_advance_address_CT(query, addr);
 
     //
     // Enqueue the response.
diff --git a/src/router_core/agent_config_address.c 
b/src/router_core/agent_config_address.c
index da96d1c..b25779a 100644
--- a/src/router_core/agent_config_address.c
+++ b/src/router_core/agent_config_address.c
@@ -186,16 +186,24 @@ void qdra_config_address_get_first_CT(qdr_core_t *core, 
qdr_query_t *query, int
         addr = DEQ_NEXT(addr);
     assert(addr);
 
-    //
-    // Write the columns of the object into the response body.
-    //
-    qdr_agent_write_config_address_CT(query, addr);
+    if (addr) {
+        //
+        // Write the columns of the object into the response body.
+        //
+        qdr_agent_write_config_address_CT(query, addr);
+
+        //
+        // Advance to the next address
+        //
+        query->next_offset = offset;
+        qdr_manage_advance_config_address_CT(query, addr);
+
+    }
+    else {
+        query->more = false;
+    }
+
 
-    //
-    // Advance to the next address
-    //
-    query->next_offset = offset;
-    qdr_manage_advance_config_address_CT(query, addr);
 
     //
     // Enqueue the response.
diff --git a/src/router_core/agent_config_link_route.c 
b/src/router_core/agent_config_link_route.c
index be690e2..c04daa2 100644
--- a/src/router_core/agent_config_link_route.c
+++ b/src/router_core/agent_config_link_route.c
@@ -185,9 +185,14 @@ static void 
qdr_agent_write_config_link_route_CT(qdr_query_t *query,  qdr_link_r
 
 static void qdr_manage_advance_config_link_route_CT(qdr_query_t *query, 
qdr_link_route_t *lr)
 {
-    query->next_offset++;
-    lr = DEQ_NEXT(lr);
-    query->more = !!lr;
+    if (lr){
+        query->next_offset++;
+        lr = DEQ_NEXT(lr);
+        query->more = !!lr;
+    }
+    else {
+        query->more = false;
+    }
 }
 
 


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

Reply via email to