Damn you’re right ! My apologies.
Time to do some clean-up in all these functions.
Regards,
David Navarro
De : wakaama-dev-bounces@xxxxxxxxxxx [mailto:wakaama-dev-bounces@xxxxxxxxxxx] De la part de Kaplan, Amir
Envoyé : jeudi 20 avril 2017 08:49
À : Wakaama developer discussions <wakaama-dev@xxxxxxxxxxx>
Objet : 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
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
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.