Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: One true regexp for untainting windows filenames?

by ikegami (Pope)
on Jan 09, 2009 at 05:33 UTC ( #735084=note: print w/ replies, xml ) Need Help??


in reply to Re^2: One true regexp for untainting windows filenames?
in thread One true regexp for untainting windows filenames?

There is no a string that

qr{(\A (?: .* / (?: \.\.?\z )? )? [^/]* )}msx

won't match.

It's wrong for two reasons.

  • "foo" gets "untainted" as "".
  • "x/xx\0xx"" is believed to be a valid file name, but it isn't.

Valid unix paths and only valid unix paths match

qr{^([\0]+)\z}

(Although that doesn't mean there can ever be a file referenced by that path.)


Comment on Re^3: One true regexp for untainting windows filenames?
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://735084]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (13)
As of 2015-07-02 22:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (46 votes), past polls