On Oct 1, 2002 at 10:47, q u a s i wrote:
At 02:39 even 9/30/02 -0700, Satya wrote:
Classic buffer overflow. Say you have[...]:
buffer over flow is defined as when you feed more data than the buffer has [free] capacity for. Due to the C legacy which does not do bound checking for array writes this may lead to to bad places. Agreed. But when you malloc you allocate /limited/ memory too. There is /no/ way to prevent you from overflowing an allocated buffer if you so wish.
I guess I should say that dynamic memory allocation, by definition, allows you to allocate as much memory as you need at runtime.
[..C for dummies example]
Haven't read that. It's a fairly obvious example.
inefficient. Someone else can have a say on this maybe. For truly flexible storage a linked lists of buffers may be more the way to go.
Like for a text editor? Yeah, and you're still mallocing the structs.