osaf/libs/agents/saf/clma/clma_api.c |  23 -----------------------
 1 files changed, 0 insertions(+), 23 deletions(-)


When CLM is going to fill the values of notification buffer, there is no need 
to check
the length values that is passed by the user.
Also, there can be cases when user has a bigger numofItems, but has allocated 
lesser than that.
In such cases, dereferencing the notification can be avoided inside this 
function.

diff --git a/osaf/libs/agents/saf/clma/clma_api.c 
b/osaf/libs/agents/saf/clma/clma_api.c
--- a/osaf/libs/agents/saf/clma/clma_api.c
+++ b/osaf/libs/agents/saf/clma/clma_api.c
@@ -117,17 +117,8 @@ static SaAisErrorT clma_validate_flags_b
 
        /* validate the notify buffer */
        if ((flags & SA_TRACK_CURRENT) && buf && buf->notification) {
-               uint32_t i;
-
                if (!buf->numberOfItems)
                        return SA_AIS_ERR_INVALID_PARAM;
-
-               // Check that nodeName is not longer than 255
-               for(i=0; i<buf->numberOfItems; i++) {
-                       
if(osaf_extended_name_length(&buf->notification[i].clusterNode.nodeName) >= 
SA_MAX_NAME_LENGTH) {
-                               return SA_AIS_ERR_INVALID_PARAM;
-                       }
-               }
        }
 
        /* Validate if flag is TRACK_CURRENT and no callback and no buffer 
provided */
@@ -167,24 +158,10 @@ static SaAisErrorT clma_validate_flags_b
 
        /* validate the notify buffer */
        if ((flags & SA_TRACK_CURRENT) && buf && buf->notification) {
-               uint32_t i;
-
                if (!buf->numberOfItems) {
                        TRACE_LEAVE();
                        return SA_AIS_ERR_INVALID_PARAM;
                }
-
-               // Check that nodeName and EE are not longer than 255
-               for(i=0; i<buf->numberOfItems; i++) {
-                       
if(osaf_extended_name_length(&buf->notification[i].clusterNode.nodeName) >= 
SA_MAX_NAME_LENGTH) {
-                               TRACE_LEAVE();
-                               return SA_AIS_ERR_INVALID_PARAM;
-                       }
-                       
if(osaf_extended_name_length(&buf->notification[i].clusterNode.executionEnvironment)
 >= SA_MAX_NAME_LENGTH) {
-                               TRACE_LEAVE();
-                               return SA_AIS_ERR_INVALID_PARAM;
-                       }
-               }
        }
 
        /* Validate if flag is TRACK_CURRENT and no callback and no buffer 
provided */

------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to