in reply to Re: Re: Untainting 'bad' filenames
in thread Untainting 'bad' filenames
I'm not sure about the taint feature in this respect, so I'll refrain from commenting further on that issue. But with the filename, when I say you do know the filename, it is in relation to the script. IOW, your spec seems to state that you do know the format of the filename, but not the filename.
But in order to compare the filename to a regex, you (the script is simply an extension of you; be the script :) have to know the filename. The regex shouldn't check all permutations of the name. It should check valid permutations.
In which case, you can write a very tight regex, since it is based on your valid filename. I think you're taking too many variables into account here with the solution of your problem. I see a single variable: the filename, and a single control: the format the filename should match. This makes it a very binary operation. It matches or it doesn't. What is it that I'm missing in this discussion? (This is purely discussion, since it seems as though someone may have provided a solution that you will use.) I'm interested in case I ever see this problem myself.
ALL HAIL BRAK!!!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Untainting 'bad' filenames
by chipmunk (Parson) on Dec 08, 2000 at 22:42 UTC | |
by PsychoSpunk (Hermit) on Dec 08, 2000 at 23:16 UTC | |
by chipmunk (Parson) on Dec 08, 2000 at 23:28 UTC |