[LCP]Very Small Doubt...

Jack Lloyd lloyd at acm.jhu.edu
Tue Jul 9 03:28:06 UTC 2002


On Mon, 8 Jul 2002, Vincent Penquerc'h wrote:

> However, remember than with scanf, you can't (AFAIK) size the allocated
> memory to what is read, thus, stack smashing possibility in the first
> patch, and arena corruption in the second. A safer way is to read
> little bits by little bits (of known size) and allocate accordingly.

Or use readline(3), getline(3) or the C++ string type; all are far more
convenient that doing this manually.

-Jack





More information about the linuxCprogramming mailing list