On Thu, 27 Jan 2005, Miles Stevenson wrote:
> I'm trying to practice safe coding techniques. I just want to make sure
> that a user can't supply a massive argument to my script and cause
> trouble. I'm just trying only accept about 256 bytes:
>
> buffer(sys.argv[1], 0, 256)
^^
Hi Miles,
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
Miles,
On Thu, 27 Jan 2005 13:08:05 -0500, Miles Stevenson
<[EMAIL PROTECTED]> wrote:
> Newbie question.
>
> I'm trying to practice safe coding techniques. I just want to make sure that a
> user can't supply a massive argument to my script and cause trouble. I'm just
> trying only accept about 2
Newbie question.
I'm trying to practice safe coding techniques. I just want to make sure that a
user can't supply a massive argument to my script and cause trouble. I'm just
trying only accept about 256 bytes:
buffer(sys.argv[1], 0, 256)
searchpath = sys.argv[1]
The script runs successfully, b