On 06/11/2015 07:30 PM, ??? wrote:
> Dear All
>
> Hi.
>
> To get payload length in CA Layer,
>
> the method related to strlen / strcpy is used like below.
>
>
> "size_t len = strlen(info.payload);"
>
> but, if NULL characteristic is included in the payload.
> CA can't get accurate length of the payload through these methods.
>
> so..I think upper layer have to express the payload length through below
> change.
>
> typedef struct
> {
>
> CAMessageType_t type;
> uint16_t messageId;
> CATokent_t token;
> uint8_t tokenLength;
> CAHeaderOption_t *option;
> uint8_t numOptions;
> CAPayload_t payload;
>
> * size_t payloadLength; // new member of the structure*
>
> } CAInfo_t;
>
> but, we should discuss it much.
>
> since RI layer also have to consider adding RI API for payloadLength.
>
> if you have some opinion.
>
> please let me know.
>
> ps. I have registerd the JIRA - https://jira.iotivity.org/browse/IOT-561
Conceptually much of the code at various layers had been confusing
c-strings for buffers. There are some significant differences and you've
hit upon some of them.
This had been pointed out several times in code reviews, and should have
been followed-up on already. The JIRA ticket can help with that.
--
Jon A. Cruz - Senior Open Source Developer
Samsung Open Source Group
jonc at osg.samsung.com