Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wakaama-dev] possible small issue?

Hi, please consider:

 

char buf[3];

utils_intCopy(buf, 3, 111)

if (3 > 3+1) return -1

buf[3] = 0; (out of range)

Regards,

Amir Kaplan

 

 

From: wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] On Behalf Of David Navarro
Sent: Wednesday, April 19, 2017 18:31
To: 'Wakaama developer discussions' <wakaama-dev@xxxxxxxxxxx>
Subject: Re: [wakaama-dev] possible small issue?

 

Hi Amir,

 

‘len’ is the length of the string containing the text representation of ‘value’ including the trailing nil character. utils_intCopy() copies the text representation to a buffer without this trailing nil-character hence the “length + 1”.

 

Regards,

David Navarro

 

De : wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] De la part de Kaplan, Amir
Envoyé : mercredi 19 avril 2017 16:38
À : Wakaama developer discussions <wakaama-dev@xxxxxxxxxxx>
Objet : [wakaama-dev] possible small issue?

 

Hi devs,

 

May be I wrong, but please consider looking at function:

 

int utils_intCopy(char * buffer,

                  size_t length,

                  int32_t value)

{

    if (len > length + 1) return -1;

 

 

I think it should be something like :

 

if (len >= length) return -1;

 

 

If I wrong please just ignore.

 

Thanks,
Amir Kaplan

 

 

---------------------------------------------------------------------
A member of the Intel Corporation group of companies

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

---------------------------------------------------------------------
A member of the Intel Corporation group of companies

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


Back to the top