in reply to Filepath validation and untainting
I don't know if there's another module to do that. I don't think it makes much sense, because by using a filetest-operator like -e I can without any danger ensure a file exists (is a file,a directory) and that includes that the path that is tested is a valid path for whatever OS I'm on, otherwise it could not point to a file.
Your regexp does in fact only check for character occurences, because everything is marked as optional via *,? (the ()+ expression only contains optional ones), so you can have '//////','XXXXXXXXXX','///ABC//DEF//', which can all be valid as path in the end. So you're better off by just using tr{/\\a-zA-Z0-9.-}{}c in order to validate no unwanted characters are found, that hase the same effect at much less work for the computer. And this singel limitation is alreade inaccurate, because a good OS allows more than these characters in filenames.
--
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Filepath validation and untainting
by hardburn (Abbot) on Feb 12, 2003 at 17:01 UTC | |
by fruiture (Curate) on Feb 12, 2003 at 18:14 UTC |