Groovy hepcat Neil Heller jived with Manish Malik on 03 Feb 98 14:24:00!
C++ SAVEDING STUFF's a cool scene. Dig it!
MM> char *s;
MM> gets(s);
MM> puts("\r\n Whether you typed 40 or 4000, I have it all! Here -");
MM> puts(s);
MM> Okay now ? :-)
NH> That's going from bad to worse. You've only allocated two bytes (in a
NH> 16-bit system or 4 bytes in a 32-bit system) to hold what the user
NH> types. That's guaranteed to tromp on somebody's memory.
No he hasn't. He hasn't allocated *any* memory to hold what the
user types in. All he has is a pointer, and that does not hold what is
typed in, it only points (or is supposed to, but doesn't) to memory
where the typed in string is stored. But since he has not pointed it
at anithing, anithing could happen.
Wolvaen
... I never forget a girl's body; I have a pornographic memory.
--- Blue Wave/RA v2.20
---------------
* Origin: The Gate, Melbourne Australia, +61-3-9809-5097 33.6k (3:633/159)
|