
19 Sep
2013
19 Sep
'13
6:09 p.m.
Hi, Sanja! On Sep 19, Sergei Golubchik wrote:
This is incorrect, it might read past the end of the buffer. it's too late to check the length *after* you've read the data.
Correct code might look like
...
strncpy(buf, *ptr, 9)
This is wrong, sorry. I'll stop at the first '\0'. Should be memcpy(buf, *ptr, *max_bytes_available); Regards, Sergei