Thanks, Hans and Anders, for your review.

About the code refactoring, should we do it in a separate ticket for all AMF API's that use such constant and format specifier? That should be an enhancement rather than a defect ticket like this one.

Thanks,
Nguyen

On 8/2/2017 6:16 PM, Anders Widell wrote:
UINT32_MAX from <cstdint> is a better constant here since we are dealing with a 32-bit integer.

regards,

Anders Widell


On 08/02/2017 09:19 AM, Hans Nordebäck wrote:
ack, code review only.

When refactoring the code, perhaps UINT_MAX from <climits> can be used instead of AVSV_UNS32_HDL_MAX?

And PRIx64 from <cinttypes> instead of %llx?

/Regards HansN

On 08/02/2017 06:01 AM, Nguyen Luu wrote:
When called with an uninitialized or already finalized handle,
saAmfPmStart_3 and saAmfResponse_4 should return SA_AIS_ERR_BAD_HANDLE
instead of SA_AIS_ERR_VERSION as previously done.
---
  src/amf/agent/amf_agent.cc | 14 ++++++++++++++
  1 file changed, 14 insertions(+)

diff --git a/src/amf/agent/amf_agent.cc b/src/amf/agent/amf_agent.cc
index 20528e9..b9191dd 100644
--- a/src/amf/agent/amf_agent.cc
+++ b/src/amf/agent/amf_agent.cc
@@ -2296,6 +2296,13 @@ SaAisErrorT AmfAgent::PmStart_3(SaAmfHandleT hdl, const SaNameT *comp_name,
    SaAisErrorT rc = SA_AIS_OK;
    TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
  +  /* Verifying the input Handle & global handle */
+  if (!gl_ava_hdl || hdl > AVSV_UNS32_HDL_MAX) {
+    TRACE_2("Invalid SaAmfHandle passed by component: %llx", hdl);
+    rc = SA_AIS_ERR_BAD_HANDLE;
+    goto done;
+  }
+
    /* Version is previously set in in initialize function */
    if (!ava_B4_ver_used(0)) {
      TRACE_2(
@@ -2844,6 +2851,13 @@ SaAisErrorT AmfAgent::Response_4(SaAmfHandleT hdl, SaInvocationT inv,
    SaAisErrorT rc = SA_AIS_OK;
    TRACE_ENTER2("SaAmfHandleT passed is %llx", hdl);
  +  /* Verifying the input Handle & global handle */
+  if (!gl_ava_hdl || hdl > AVSV_UNS32_HDL_MAX) {
+    TRACE_2("Invalid SaAmfHandle passed by component: %llx", hdl);
+    rc = SA_AIS_ERR_BAD_HANDLE;
+    goto done;
+  }
+
    /* Version is previously set in in initialize function */
    if (!ava_B4_ver_used(0)) {
      TRACE_2(


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel





------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to