[Tutor] Safely buffering user input

Max Noel maxnoel_fr at yahoo.fr
Thu Jan 27 19:28:06 CET 2005


On Jan 27, 2005, at 18:17, Bill Mill wrote:

> I've never used buffer(); in fact, I didn't even know it existed, and
> I've been using python for a while now.
>
> Instead of using buffer, just do:
>
> sys.argv[1] = sys.argv[1][:255]
>
> This says "Set the second element of sys.argv equal to its first 256
> characters".

	Also, I don't think you have to worry about buffer overflows in 
Python, unless you're using a seriously broken implementation of it.

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
"Look at you hacker... A pathetic creature of meat and bone, panting 
and sweating as you run through my corridors... How can you challenge a 
perfect, immortal machine?"



More information about the Tutor mailing list