Peter,

buf->Data[buf->DataLength] = '\0';


shall be


if ( buf->DataLength < SAHPI_MAX_TEXT_BUFFER_LENGTH ) {
      buf->Data[buf->DataLength] = '\0';
} else {
      buf->Data[SAHPI_MAX_TEXT_BUFFER_LENGTH - 1] = '\0';
}

or

buf->Data[ (buf->DataLength < SAHPI_MAX_TEXT_BUFFER_LENGTH) ?
buf->DataLength : (SAHPI_MAX_TEXT_BUFFER_LENGTH - 1)] = '\0';


to avoid possible data corruption.

Setting buf->Data[SAHPI_MAX_TEXT_BUFFER_LENGTH] is setting data beyong
TextBuffer structure.
It may corrupt another object or may produce segmentation violation.

        Anton Pak


On Fri, 31 Oct 2008 16:19:18 +0300, Peter D Phan <[EMAIL PROTECTED]> wrote:

>
> Anton,
>
>> Regarding "2182034 Incorrect displaying of SaHpiTextBufferT in
> hpi_shell":
>> There is potential issue: when Data array in TextBuffer is fully loaded,
>
>> i.e DataLength = 255.
>> In this case adding '\0' at the end may corrupt another data.
>
> Yes, if the TextBuffer is fulled, I choose to have the data truncated by
> one char to have the string properly NULL terminated to ensure that any
> further action on this string using standard string function will work
> properly.
>
> Peter,
> Regards,
> --------------------------------------------------------------------------------------------
>
> P. D. Phan
> IBM Austin
> --------------------------------------------------------------------------------------------
>
>
>             "Anton Pak"
>              <[EMAIL PROTECTED]
>              point.com>                                                  
> To
>                                        [email protected]
>              10/31/2008 06:12                                            
> cc
>              AM
>                                                                    Subject
>                                        Re: [Openhpi-devel] Proposed
>              Please respond to         November release date
>              [EMAIL PROTECTED]
>              ts.sourceforge.ne
>                      t
>
>
>
>
> Thanks!
>
> Could you also look into "2211619 Typo in type for session"?
>
> Regarding "2182034 Incorrect displaying of SaHpiTextBufferT in  
> hpi_shell":
> There is potential issue: when Data array in TextBuffer is fully loaded,
> i.e DataLength = 255.
> In this case adding '\0' at the end may corrupt another data.
>
>              Anton Pak
>
> On Thu, 30 Oct 2008 21:57:23 +0300, Peter D Phan <[EMAIL PROTECTED]>  
> wrote:
>
>>
>>
>>
>>
>>
>> Anton, Done!!
>>
>> Regards,
>>
> --------------------------------------------------------------------------------------------
>
>>
>> P. D. Phan
>> IBM Austin
>>
> --------------------------------------------------------------------------------------------
>
>>
>>
>>             "Anton Pak"
>>              <[EMAIL PROTECTED]
>>              point.com>
>> To
>>
> [email protected]
>>              10/30/2008 07:49
>> cc
>>              AM
>>
> Subject
>>                                        Re: [Openhpi-devel] Proposed
>>              Please respond to         November release date
>>              [EMAIL PROTECTED]
>>              ts.sourceforge.ne
>>                      t
>>
>>
>>
>>
>> Hello!
>>
>> Excuse me for troubling you.
>> Could you look for possibility of including the following bugfixes:
>>
>> 2187132            Incorrect error returned by  
>> saHpiSensorThresholdsSet()
>> 2182034            Incorrect displaying of SaHpiTextBufferT in hpi_shell
>> 2171901            HPI session is not closed after quit
>>
>> ?
>>
>>                          Anton Pak
>>
>> On Mon, 27 Oct 2008 18:45:22 +0300, Peter D Phan <[EMAIL PROTECTED]>
>> wrote:
>>
>>>
>>>
>>>
>>>
>>> Allowing for Thanksgiving holidays,   I propose the below dates for
>>> 2.13.1
>>> Release.  Please let me know if the one new feature and one bug fix are
>>> enough content for the release; or the dates need to be moved.
>>>
>>> 12 November 2008, noon ---  Code freeze/snapshot for 2.13.1
>>> 12-18 November                  ---  Testing
>>> 18 November 2008, noon ---  2.13.1 Release
>>>
>>>
>>> Changelog for 2.13.1
>>> -------------------
>>> [New Features - Closed ]
>>>  HP c-Class Plugin
>>>    2175525 - Add underpinnings for additional management functions
>>>
>>>
>>> [New Features - Open ]
>>>  Documentation
>>>    2042355 - Missing man pages for most of the client applications HPI
>>> Utils
>>>
>>> [Fixed Bugs - Open ]
>>>  OpenHPI base library
>>>    2188639 - saHpiResourceFailedRemove() fails if only FRU cap is set
>>>
>>> Changelog for 2.13.0
>>> -------------------
>>> [New Features]
>>>  IPMI Direct plugin
>>>    1548421 - Support of auto insertion/extraction timeouts != 0&-1
>>>    1285090 - Cleanup plugin: change assert to better error handling  
>>> code
>>>
>>>
>>>
>>>
>>> Regards,
>>>
>>
> --------------------------------------------------------------------------------------------
>
>>
>>>
>>> P. D. Phan
>>> IBM Austin
>>>
>>
> --------------------------------------------------------------------------------------------
>
>>
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Openhpi-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/openhpi-devel
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the  
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Openhpi-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openhpi-devel

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Openhpi-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openhpi-devel

Reply via email to