Thread Previous • Date Previous • Date Next • Thread Next |
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
Thread Previous • Date Previous • Date Next • Thread Next |