Hi Hoang Vo,

This patch is already published by Nhat Pham , and

it is under review, I also provided few comments ( attached ) , please check.

-AVM


On 6/14/2016 1:48 PM, Hoang Vo wrote:
  osaf/services/saf/cpsv/cpnd/cpnd_evt.c |  11 +++++++++++
  1 files changed, 11 insertions(+), 0 deletions(-)


When a section with id size greater than MAX_SEC_ID_LEN [50], the cpnd restarts 
with core dump.
This fixing validates id size before creating section.

diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c 
b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -2167,6 +2167,7 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
        CPSV_CKPT_DATA *ckpt_data = NULL;
        SaTimeT now, duration;
        int64_t time_stamp, giga_sec, result;
+       uint16_t sec_id_len = evt->info.sec_creatReq.sec_attri.sectionId->idLen;
TRACE_ENTER();
        memset(&send_evt, '\0', sizeof(CPSV_EVT));
@@ -2205,6 +2206,16 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
                TRACE_4("cpnd ckpt sect create failed for ckpt_id:%llx,return 
value:%d",evt->info.sec_creatReq.ckpt_id, SA_AIS_ERR_INVALID_PARAM);
                goto agent_rsp;
        }
+
+       if (sec_id_len >= MAX_SEC_ID_LEN) {
+               send_evt.type = CPSV_EVT_TYPE_CPA;
+               send_evt.info.cpa.type = CPA_EVT_ND2A_SEC_CREATE_RSP;
+               send_evt.info.cpa.info.sec_creat_rsp.error = 
SA_AIS_ERR_INVALID_PARAM;
+               LOG_NO("cpnd ckpt sect create failed for ckpt_id:%llx,return 
value:%d - sec_id_len:%d over supported limit %d",
+                               evt->info.sec_creatReq.ckpt_id, 
SA_AIS_ERR_INVALID_PARAM, sec_id_len, MAX_SEC_ID_LEN);
+               goto agent_rsp;
+       }
+
        if (evt->info.sec_creatReq.sec_attri.sectionId->id == NULL &&
            evt->info.sec_creatReq.sec_attri.sectionId->idLen == 0) {
                if (cp_node->create_attrib.maxSections > 1) {

--- Begin Message ---
Hi Nhat Pham,

>>this macro was defined long time ago.

Any we are planning to have LONG DN for CKpt as well,

so let us consider how much max size we can accommodate for section as well ( considering #1574: CKPT support for Long DN)

If required re-send the patch.

-AVM



On 6/6/2016 1:20 PM, Nhat Pham wrote:
Hi Mahesh,

I'm not sure about this.
Checking the history, this macro was defined long time ago.

changeset:   619:2d68497895b2
user:        Jonathan Fournier <jonathan.fourn...@windriver.com>
date:        Thu Aug 06 00:59:42 2009 -0400
summary:     build: re-organize the source tree layout to fit the build
dependencies

Best regards,
Nhat Pham

-----Original Message-----
From: A V Mahesh [mailto:mahesh.va...@oracle.com]
Sent: Monday, June 6, 2016 11:24 AM
To: Nhat Pham <nhat.p...@dektech.com.au>; anders.wid...@ericsson.com
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 2 of 2] cpnd: To reject creating section which has id
length longer than MAX_SIZE(30) [#1667]

Hi Nhat Pham,

Which was forcing us to have MAX_SIZE(30) limit ?

-AVM

On 6/6/2016 9:19 AM, Nhat Pham wrote:
   osaf/services/saf/cpsv/cpnd/cpnd_evt.c |  11 +++++++++++
   1 files changed, 11 insertions(+), 0 deletions(-)


diff --git a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
--- a/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
+++ b/osaf/services/saf/cpsv/cpnd/cpnd_evt.c
@@ -2151,6 +2151,7 @@ static uint32_t cpnd_evt_proc_ckpt_sect_
        CPSV_CKPT_DATA *ckpt_data = NULL;
        SaTimeT now, duration;
        int64_t time_stamp, giga_sec, result;
+       uint16_t sec_id_len =
+evt->info.sec_creatReq.sec_attri.sectionId->idLen;

        TRACE_ENTER();
        memset(&send_evt, '\0', sizeof(CPSV_EVT)); @@ -2189,6 +2190,16 @@
static uint32_t cpnd_evt_proc_ckpt_sect_
                TRACE_4("cpnd ckpt sect create failed for
ckpt_id:%llx,return value:%d",evt->info.sec_creatReq.ckpt_id,
SA_AIS_ERR_INVALID_PARAM);
                goto agent_rsp;
        }
+
+       if (sec_id_len >= MAX_SIZE) {
+               send_evt.type = CPSV_EVT_TYPE_CPA;
+               send_evt.info.cpa.type = CPA_EVT_ND2A_SEC_CREATE_RSP;
+               send_evt.info.cpa.info.sec_creat_rsp.error =
SA_AIS_ERR_INVALID_PARAM;
+               LOG_NO("cpnd ckpt sect create failed for ckpt_id:%llx,return
value:%d - sec_id_len:%d over supported limit %d",
+                               evt->info.sec_creatReq.ckpt_id,
SA_AIS_ERR_INVALID_PARAM, sec_id_len, MAX_SIZE);
+               goto agent_rsp;
+       }
+
        if (evt->info.sec_creatReq.sec_attri.sectionId->id == NULL &&
            evt->info.sec_creatReq.sec_attri.sectionId->idLen == 0) {
                if (cp_node->create_attrib.maxSections > 1) {



--- End Message ---
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to