I think it should be > 2 as length part has 2 bytes and there will be 
some value also.

Thanks
Praveen

On 22-Aug-14 4:01 PM, Anders Widell wrote:
> Ack.
>
> Question: Should the comparison in the assertion be > 2 or >= 2?
>
> / Anders Widell
>
> On 08/22/2014 07:06 AM, Minh Hon Chau wrote:
>>   osaf/libs/agents/saf/ntfa/ntfa_api.c     |  1 +
>>   osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc |  4 ++--
>>   2 files changed, 3 insertions(+), 2 deletions(-)
>>
>>
>> (1) Assert the dataSize must be larger than 2
>>
>> (2) Replace delete by free due to memory allocation by malloc/calloc
>>
>> diff --git a/osaf/libs/agents/saf/ntfa/ntfa_api.c
>> b/osaf/libs/agents/saf/ntfa/ntfa_api.c
>> --- a/osaf/libs/agents/saf/ntfa/ntfa_api.c
>> +++ b/osaf/libs/agents/saf/ntfa/ntfa_api.c
>> @@ -1294,6 +1294,7 @@ SaAisErrorT saNtfNotificationSend(SaNtfN
>>       SaUint16T i = 0;
>>       for(i=0 ; i < ntfHeader->numAdditionalInfo ; i++ ) {
>>           if (ntfHeader->additionalInfo[i].infoType ==
>> SA_NTF_VALUE_LDAP_NAME) {
>> +
>> osafassert(ntfHeader->additionalInfo[i].infoValue.ptrVal.dataSize > 2);
>>               SaNameT *ptr = send_param->variable_data.p_base +
>>
>> ntfHeader->additionalInfo[i].infoValue.ptrVal.dataOffset;
>>               if (!ntfsv_sanamet_is_valid(ptr)) {
>> diff --git a/osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc
>> b/osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc
>> --- a/osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc
>> +++ b/osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc
>> @@ -302,7 +302,7 @@ void NtfAdmin::notificationReceivedUpdat
>>           TRACE_2("notification %u received"
>>                   " again, skipped", (unsigned int)notificationId);
>>           ntfsv_dealloc_notification(sendNotInfo);
>> -        delete sendNotInfo;
>> +        free(sendNotInfo);
>>       }
>>       else
>>       {
>> @@ -346,7 +346,7 @@ void NtfAdmin::notificationReceivedColdS
>>           TRACE_2("notification %u received"
>>                   " again, skipped", (unsigned int)notificationId);
>>           ntfsv_dealloc_notification(sendNotInfo);
>> -        delete sendNotInfo;
>> +        free(sendNotInfo);
>>       }
>>       else
>>       {
>

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to